Some organizations don't want every user to be able to use ActiveSync, especially in the days of BYOD (Bring Your Own Device). With a PowerShell script, you can enable ActiveSync for the users who do need it.
First create a Group for ActiveSync enabled users called something like "ActiveSync Enabled".
Then copy/paste the below text into Notepad and save it as a .ps1...you can call whatever you want.
$mailboxes = Get-CASMailbox -resultSize unlimited
$asusers = Get-DistributionGroupMember -Identity 'ActiveSync Enabled'
$asguids = @()
foreach ($user in $asusers) {
$asguids += $user.GUID
}
foreach ($mailbox in $mailboxes) {
if ($asguids -contains $mailbox.GUID ) {
if ($mailbox.ActiveSyncEnabled -ne $true) {
$mailbox | Set-CASMailbox -ActiveSyncEnabled $true
echo "$mailbox is enabled"
}
}
else {
if ($mailbox.ActiveSyncEnabled -ne $false) {
$mailbox | Set-CASMailbox -ActiveSyncEnabled $false
echo "$mailbox is disabled"
}
}
}
Run the script and it will enable AES (ActiveSync) for the users that belong in the group. You can set it as a Scheduled Task so when you add new users to the group you don't have to rerun the script every time.
No comments:
Post a Comment