This can be done with PowerShell.
The general process would be something like this:
- Read the file line by line with the usernames you want to disable, and loop over the usernames
$username to get the AD object for the users one by one
- Check the objects you get, if they are disabled. You can use the
Enabled property on the ADUser for this.
- If they need disabling, use the
Move-ADObject cmdlets to accomplish that.
You may even be able to do this as a oneliner if you really wanted to. Something like:
Get-Content userstodisable.txt | Get-ADUser | Where Enabled -eq True | Disable-ADAccount -PassThru | Move-ADObject -TargetPath OU=Disabled,DC=corp,DC=example,DC=com
Feel free to hack around with this until you get it right.