I want to set all user mailboxes that are members of a security group and do not have activesync to have it enabled.
$m = Get-Recipient -resultsize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox') -and (MemberOfGroup -contains 'security group')} foreach ($mailbox in $m){ Get-CASMailbox $mailbox | fl activesync* if ((Get-CASMailbox $mailbox).ActiveSyncEnabled -eq $false){ Set-CASMailbox $mailbox -ActiveSyncEnabled $true } }