1) I have a txt list with sAMAaccountNames
2) I need to query each account name and verify whether it is disabled
3) if the account is disabled, delete it from AD
I'll just delete them manually if there isn't another way, but first I need to check all the accounts in my list to see if they are disabled or not.
I have powershell v2.0 installed on this server and the DC is windows server 2003. The management server is windows server 2008.
I don't have the Active Directory module and I cannot install it either.
How can I do this with CMD/VBScript or powershell v2.0?
I have tried to run
dsquery -Filter "(userAccountControl:1.2.840.1135188.8.131.523:=2)"
but I got the following error
dsquery failed:The parameter is incorrect.:Incorrect object type specified. type dsquery /? for help.