Skip to content

Instantly share code, notes, and snippets.

@tomfanning
Created March 13, 2018 14:19
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