PoshCode Archive  Artifact [2f606a20b3]

Artifact 2f606a20b37585ede8765b8f5226f7a1b1feb1bd37bf82223c6f5baabcf84d1f:

  • File Amazon-AWS-user-data.ps1 — part of check-in [eafd2db9f5] at 2018-06-10 13:33:21 on branch trunk — 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. (user: AdrianWoodrup size: 622)

# 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: 3939
# x-archived: 2017-04-30T10:37:40
# x-published: 2013-02-12T14:23:00
#
#
<powershell>

$ComputerName = $env:COMPUTERNAME
$user = [adsi]"WinNT://$ComputerName/Administrator,user"
$user.setpassword("Password")

</powershell>