Powershell


How to enable GPEdit.msc in Windows 10 Home Edition

By default gpedit.msc is not enabled on Windows 10 Home (inclusing 7/8.1 editions). The good news it’s possible to enable this feature.

Copy the above code to a batch script / powershell and execute it with administrative rights.

After executing I advice you to reboot. After rebooting you notice that gpedit.msc is now working :


How to show (export) all devices synchronizing with your Office 365

For a MDM project I had to make an dump which users are using which devices to (active)sync with their Office 365 mailboxes. This is how I did that :

Get-Mailbox -ResultSize Unlimited | ForEach {Get-MobileDeviceStatistics -Mailbox:$_.Identity} | Select-Object @{label=”User” ; expression={$_.Identity}},DeviceModel,DeviceOS, lastsuccesssync | Export-csv F:\powershell\activesync.csv

Running the above command showed the following output (in a CSV file format):

As you can see you see the user, the device the user is using, the OS their device uses and last time that devices succesfully synchronized.

I used Excel to import the CSV and sort on LastSuccessSync.

Find out here how to connect to Office 365 using Powershell.


Powershell: Easily export your Windows Drivers

I was looking for a simple solution for me to export (and import later) my Windows driver. I already knew that Windows 2016 had a Powershell command for that but didn’t knew that it also worked for Windows Server 2012R2 and Windows 10!

Use the following command : Export-WindowsDriver -Destination “C:\Drivers\$((Get-WmiObject -Class win32_computersystem).Model)” -Online

export_drivers

Notice the exported drivers:

export_drivers2

Now you can easily import those drivers in (for example) SCCM or MDT.

 


Powershell: Start using PowerShell using PowerShell Command Builder

Microsoft TechNet site has a great site that enables you to build your own cmdlets using a web drag and drop interface.

There is support for :

image

Let’s try Office 365 :

image

You notice the drag and drop interface. First select the verb, for example Get. Click get and the send arrow. Now choose a Noun, for example Msol User:

image

After selecting the Verb and Noun you notice the other extra options. Fill them in when needed. Now hit the Copy to Clipboard button to copy the PowerShell command to your Clipboard and start using PowerShell to manage your Office 365.

You can find the site here.


Powershell: Connect to Azure Active Directory and Microsoft O365

Use the following Powershell script to connect to Azure Active Directory and Microsoft O365. This enables you to use all the O365 Powershell commands.

 

image

(Download the Powershell plugin here)


Office 365 : Disable Clutter (onbelangrijke mail) function

In this post I describe how to disable/enable the Clutter function of O365. The clutter feature is self learning and there are not many options you can specify. You can drag messages to and from the Clutter mailbox so that it can learn how to work. But sometimes you want do disable this function for specific mailboxes.

To disable Clutter for the entire organization you can use the following Powershell command:

Get-Mailbox | Set-Clutter -Enable $false

To disable Clutter for a single mailbox use the following command :

Set-Clutter -Identity helpdesk -Enable $false

To enable Clutter replace $false by $true

 

SNAGHTMLc9d7c89


Office 365 Powershell: Delegate Calender rights

Use the following steps to delegate (Calender) rights to a specific user.

First step specify your (administrator) credentials:

$LiveCred = Get-Credential

Create the session:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection

Now import the Office 365 session using the following command:

Import-PSSession $Session

Use the following command to delegate the calender from user1 to specified user2

Add-MailboxFolderPermission -Identity user1@domain.com:\calendar -user user2@domain.com -AccessRights Editor

SNAGHTMLb41a829

Et voilĂ ! The calender rights are set.


Powershell : How to identify (and delete) specific email messages from Office 365 1

I was looking for a way to identify messages in my Outlook Mailbox and easily delete them.

First connect to Office 365 with you (admin) credentials using the LiveCred command.

Set the Execution Policy and import the commandlets.

Using the next command creates an export of all emails from the specified user in the emailbox username and puts that export in the mailbox of user target mailbox and creates an folder called Searchlogs.

 

In that folder you find the logging of the files specified :

Results_powershell

 

Open the zip file containing the CSV export.

 

When you are ready to delete those files use the following command :

Now all the files from the specified user are deleted. You can also use the -subject:’subjectname” switch.