Exchange 2010: Allow Active Sync only for certain users

If you only want to allow Active Sync for certain users, you can let a script do the work for you. This small script initially deactivates Active Sync for all mailboxes and then only activates it for the mailboxes in the "user_with_activesync.csv" file.

Contents of the file "set-activesyncuser.ps1"

Set-ADServerSettings -ViewEntireForest $true

get-mailboxdatabase | get-mailbox | Set-CasMailbox -ActiveSyncEnabled $false

Import-CSV user_with_activesync.csv -delimiter ';' |

foreach {

$mbx = $_.user

write-host $mbx

Set-CasMailbox -ActiveSyncEnabled $true -Identity "$mbx"

}

The file "user_with_activesync.csv" looks like this:

user;

user1

user2

user3

Please leave the first line unchanged, then add one mailbox (alias) per line for which Active Sync should be allowed. Save both files in any directory and execute via Exchange Management Shell. Done!

The script falls into the Quick&Dirty category, so don't be surprised if errors like this one occur:

Active Sync

Active Sync cannot be activated on resource mailboxes, but the script does not check this J....Must go fast... J

Leave a Comment