Hi guys,

 

this script will use psremoting to connect a desired DC, will ask for a user name of the user,will check if it locked out, if it is, it will unlock it.

After that it will close the session 

 

the most important thing is when the Credential window is Pop Up, don't press enter after you enter your domain\username, if you press

enter, the OS things that you have entered your credential, and you will have to run the script again

sample of the Script

 

 

PowerShell
Edit|Remove
#ask User for the local AD server 
 
$AdServer = Read-Host -Prompt "Please enter the name of the diserd AD server" 
 
#ask User for appropriate credentials 
 
$cred =$Host.ui.PromptForCredential("Domain Network credential are needed""Please enter your yourdomain_domain\user_name and password.""""NetBiosUserName")