PoshCode Archive  Artifact [7326f38ae8]

Artifact 7326f38ae8dfc3bf95bad8b68d7cd5b427165f8dd555928528fbe39b84e7ea01:

  • File Amazon-AWS-user-data.ps1 — part of check-in [c4035a952a] at 2018-06-10 13:47:37 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: 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>