For sometime I was looking for a script which can remove the group membership of all selected hundreds of disabled user accounts and make them hidden from Exchange Address List and also if needed can move them into another OU. But my search never got some fruitful results also I tried doing the same by building my own script with native PowerShell CMD-Lets for Active Directory module but didn’t work. It might be because I’m not too good with scripting.
Well recently I found one wonderful script which can help you to do the following:
- Removing Active Directory group membership (except Doman User group as it is the primary group and you cannot delete its membership) for Disabled User Accounts provided in a CSV file
- Moving the user accounts into another OU (optional)
- Hide the disable user accounts from the Exchange Address List
This script is written by “Jason Medlin” and you can find the script official posting over here.
All you need to download and install Quest PowerShell module for Active Directory. It’s a free tool and will allow you to make this script work.
So let’s export all the user account into CSV file and keep their “SamAccountName” name only and that’s it. You have to edit the CSV file location in this script and when you execute it will perform the above mentioned tasks against the provided user names in the CSV file.
Cheers!