Created
August 25, 2015 19:56
-
-
Save stefanteixeira/14234c1ba4524df700ef to your computer and use it in GitHub Desktop.
Script to reset the Windows Server Administrator password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$name = (Get-Item Env:\COMPUTERNAME).Value | |
$user = [adsi]"WinNT://$name/Administrator,user" | |
$user.SetPassword("FooBar@123") | |
$user.SetInfo() | |
cmd.exe /c net stop winrm | |
cmd.exe /c sc config winrm start= auto | |
cmd.exe /c net start winrm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment