Hi,
I have made up the following script to do the above. It finds the users i want to perform the action on but itsnt hiding the users from the GAL.
Any ideas please?
Thanks
Code:# Query Options # $searchRoot = "school.local/School Users/school/Students" # Where to begin your recursive search - If you use top-level (e.g. "domain.local/") make sure to have a trailing slash, otherwise do not use a slash (e.g. "domain.local/Users") $inactiveDays = 80 # Integer for number of days of inactivity (e.q. 90) ###################### # 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" $inactiveUsers = get-qaduser -SearchRoot $searchRoot -disabled -NotMemberof "No Auto Disable" -NotLoggedOnFor $inactiveDays -anr "SMTP:*" -ldapfilter "(!(msExchHideFromAddressLists=*))" -sizelimit 0 | select samaccountname foreach($user in $inactiveUsers){ set-mailbox $name.samaccountname -HiddenFromAddressListsEnabled $true } # 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


LinkBack URL
About LinkBacks



