Generation

gitTue, 20 Dec 2022

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 } }

Want to kickstart your project?Use the new AI Studio to create your code