FN-GM Posted December 20, 2012 Posted December 20, 2012 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 # 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
sukh Posted December 20, 2012 Posted December 20, 2012 Has it set the attribute on the mailbox? Is it a case of waiting fir OAB to be update on clinets?
sukh Posted December 20, 2012 Posted December 20, 2012 It hasn't set the attribute no. Is the samaccountname and alias the same?
FN-GM Posted December 20, 2012 Author Posted December 20, 2012 I think so, will check in the morning.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now