Bulk user account disable in Active Directory 2008 R2
Posted on 2013-12-12
I have a list of some 900+ people who have left our organisation in the past year and a half. For one reason or another these accounts are still live in our new Active Directory environment and I need a script, preferably a PowerShell script to disable all of these accounts. The only unique information I have for each user is their payroll number (which in AD is listed as their UID attribute), I do not have the sAMAccountname for any of these accounts.
A script is needed to import the UID from a CSV file, to find that user in AD based on their UID, and then to disable the accounts. I’d also like to populate the ‘Description’ field for each of these users essentially saying that they are disabled accounts, when they were disabled and by whom.
Any help gratefully received!