You can use Active Directory Users and Computers snap-in to unlock an user account. In case you do not know the name of the domain controller where the user account got locked, you need to connect to each domain controller using Active Directory Users and Computers and then unlock the user account. Unlock-ADAccount PowerShell cmdlet can help you unlock user account on all domain controllers.
Steps:
- Create a Text file.
- Specify all the domain controllers in it.
- Run below command to unlock an user account on all domain controllers.
- For /F “Tokens=*” %L IN (DCList.TXT) DO Unlock-ADAccount NickS -Server %L
Above command unlocks user account named NickS all domain controllers specified in the DCList.TXT file.
About Nirmal Sharma
Nirmal is a MCSEx3, MCITP and was awarded Microsoft MVP award in Directory Services and Windows Networking. He is specialized in Directory Services, Failover cluster, Hyper-V, System Center, Windows Azure, and Exchange Servers and has been involved in Microsoft Technologies since 1994. In his spare time, he offers technical help by writing tips and articles on several web sites. Nirmal can be reached at [email protected].
Exactly what I need, sadly I have not yet been able to make it work
Am substituting USERID for real userid, and have creatd the DCList.TXT in the same folder containing domain controllers .
However get missing parenthesis errors
PS C:\AD> For /F “Tokens=*” %L IN (DCList.TXT) DO Unlock-ADAccount USERID -Server %L
At line:1 char:4
+ For /F “Tokens=*” %L IN (DCList.TXT) DO Unlock-ADAccount USERID -Serv …
+ ~
Missing opening ‘(‘ after keyword ‘for’.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingOpenParenthesisAfterKeyword