# encoding: ascii
# api: xml
# title: Amazon AWS user data
# description: This code can be added to an AWS instance to set the default password of an EC2 instance. It stops the need for using keys to set the windows password. It needs to be set in the “User Data” section when building the Instance.
# version: 0.1
# author: AdrianWoodrup
# license: CC0
# x-poshcode-id: 4899
# x-archived: 2016-11-08T05:54:56
# x-published: 2016-02-14T18:01:00
#
#
<powershell>
$ComputerName = $env:COMPUTERNAME
$user = [adsi]"WinNT://$ComputerName/Administrator,user"
$user.setpassword("Password")
</powershell>