Skip to content

Instantly share code, notes, and snippets.

@stefanteixeira
Created August 25, 2015 19:56
Show Gist options
  • Save stefanteixeira/14234c1ba4524df700ef to your computer and use it in GitHub Desktop.
Save stefanteixeira/14234c1ba4524df700ef to your computer and use it in GitHub Desktop.
Script to reset the Windows Server Administrator password
$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