Thursday, April 25, 2013

Hide all AD disabled user's of an OU from exchange





$UsersToDisable = @(Get-Mailbox -OrganizationalUnit "OU=Disabled,DC=contoso,DC=com")

ForEach ($User in  $UsersToDisable){
Set-Mailbox  -HiddenFromAddressListsEnabled $True -Identity $User.samaccountname
}