Skip to content

Instantly share code, notes, and snippets.

@tomfanning
Created March 13, 2018 14:19
Show Gist options
  • Save tomfanning/10be8decc97533a84d712db9e5862843 to your computer and use it in GitHub Desktop.
Save tomfanning/10be8decc97533a84d712db9e5862843 to your computer and use it in GitHub Desktop.
AWS EC2 userdata script to set Windows admin password
<powershell>
$windows_admin_password="mypassword"
function log {
echo $args[0] | out-file -append c:\bootstrap-status.log
}
log "Setting Windows password"
$admin = [adsi]("WinNT://./administrator, user")
$admin.PSBase.Invoke("SetPassword", $windows_admin_password)
</powershell>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment