My PowerShell

Windows Powershell scripts, examples, tips, docs …

How to Enable and Disable ActiveSync For Exchange Users

To see ActiveSync Enabled users:

Get-CASMailbox -resultSize unlimited -filter {activeSyncEnabled -eq $true}

 

Note: Sometimes you can see Resource mailboxes in this list. If you try to disable ActiveSync for them, you get an error like this: “The action ‘Set-CASMailbox’, ‘ActiveSyncEnabled’, may not be performed by the Resource Mailbox….”

Use this script to see only users with activated devices:

Get-CASMailbox -ResultSize Unlimited | where { $_.ActiveSyncEnabled -eq $true -and $_.hasactivesyncdevicepartnership -eq $true } | ft name, activesyncenabled –autosize

Disable Active Sync for All Users:

get-Mailbox | set-CASMailbox -ActiveSyncEnabled:$False

 

Enable ActiveSync for All Users:

get-Mailbox | set-CASMailbox -ActiveSyncEnabled:$True

 

So far I couldn’t find a way how to disable ActiveSync by default for new mailboxes. If you know how to do it, please let me know.

The workaround, I use a script to disable the ActiveSync feature of all accounts who are created within one day:

 Get-User -ResultSize Unlimited | Where {($_.WhenCreated -gt (get-date).adddays(-1))} | Set-CASMailbox -ActiveSyncEnabled $false

Tagged as: , ,

Leave a Response