Hide Disbaled Users From GAL Exchange 2010
Hi,
I wish to create a script that will hide users from the Exchange Address list that are disabled. I have pinched a script and i can seem to get it to work. I dont get any errors. Can anyone spot the problem please?
Thanks
# Add Quest / Exchange Snaps
Add-PSSnapin Quest.ActiveRoles.ADManagement # Adds Quest "qaduser" commands
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 # Adds Exchange Shell Commands
# Squelches error
$ErrorActionPreference="SilentlyContinue"
$user = get-qaduser -SearchRoot "falinge.int/Staff User Accounts" -disabled -NotMemberof "No Auto Disable" -anr "SMTP:*" -ldapfilter "(!(msExchHideFromAddressLists=*))" -sizelimit 0 | select samaccountname
foreach($name in $user){
set-mailbox -HiddenFromAddressListsEnabled $True -identity $name.samaccountname
}
# Force update of OAL Generator
Get-OfflineAddressBook | Update-OfflineAddressBook
# Pause script for 30 seconds
Start-Sleep -s 30
# Force update of OAB on CAS
Get-ClientAccessServer | Update-FileDistributionService
June 5th, 2012 8:06am
Hi,
I would use EMS and run something like this:
Get-User -RecipientTypeDetails usermailbox | where {$_.UserAccountControl -like "*AccountDisabled*"} | Set-Mailbox -HiddenFromAddressListsEnabled $TrueMartina Miskovic
Free Windows Admin Tool Kit Click here and download it now
June 5th, 2012 9:13am
Hi FNGM,
Any updates?Frank Wang
TechNet Community Support
June 6th, 2012 3:04am