# Script to move Disabled Users to Disabled OU # Removes from Address book as well Import-Module ActiveDirectory if (!($cred)){ $cred = Get-Credential -Message "Please Enter your Domain Admin account" -Title "Domain Admin Prompt" } Get-ADUser -SearchBase "OU=MPEUsers,DC=MPE,DC=CA" -filter * | where -Property Enabled -eq $false | Move-ADObject -TargetPath "OU=Users,OU=Disabled Objects,DC=mpe,DC=ca" -Credential $cred $disabledUsers = Get-ADUser -searchbase "OU=Users,OU=Disabled Objects,DC=mpe,DC=ca" -filter * -Properties msExchHideFromAddressLists foreach ($user in $disabledUsers) { $user| Set-ADObject -Replace @{msExchHideFromAddressLists=$true} -Credential $cred }