Our tech tip this week will help you in the process to enable/disable ActiveSync in Powershell by CSV, Single User and Attribute.
Some organizations require for some users or vendors not to have ActiveSync enabled. Below are scripts on how to disable/enable ActiveSync by CSV, Attribute-based and by a single user. Disabling ActiveSync for users can also be done through Exchange Admin Center.
Additional Sources:
Instructions:
Connect to Exchange Online using the Windows Azure Powershell Module
Enable ActiveSync For A Single User:
Set-CASMailbox -Identity [email protected] -ActiveSyncEnabled $True
Disable ActiveSync For A Single User:
Set-CASMailbox -Identity [email protected] -ActiveSyncEnabled $False
Disable ActiveSync For A Group Of Users With AD Attribute Department Matching “Vendor”
Get-User -RecipientTypeDetailsUserMailbox | where {$_.Department -eq “Vendor”} | Set-CASMailbox -ActiveSyncEnabled $False
Enable ActiveSync For A Group Of Users With AD Attribute Department Matching “Vendor”
Get-User -RecipientTypeDetailsUserMailbox | where {$_.Department -eq “Vendor”} | Set-CASMailbox -ActiveSyncEnabled $True
Disable ActiveSync By CSV:
Instructions:
- Create a CSV file name the top Column Users and under that column specify the users.
- Update the CSV path for the import and update the Log File path.
Script:
Import-CSV “C:\temp\ActiveSYNC.csv” | foreach {Set-CASMailbox -Identity $_.User -ActiveSyncEnabled $False} 2>> “c:\temp\Active-Sync-Disable-Logs.txt”
Screen Shot Example Of CSV:
Enable ActiveSync By CSV:
Instructions:
- Create a CSV file name the top Column Users and under that column specify the users.
- Update the CSV path for the import and update the Log File path.
Script:
Import-CSV “C:\temp\ActiveSYNC.csv” | foreach {Set-CASMailbox -Identity $_.User -ActiveSyncEnabled $True} 2>> “c:\temp\Active-Sync-Enable-Logs.txt”
Related blog posts
Get our updates straight to your inbox!
Sign up for our email updates to make sure you don't miss any of our new content.