PoshCode Archive  Artifact [71a16fc96b]

Artifact 71a16fc96b41aa8bf08874f56a325c1a6deea358ddfdfe9a37e702ab9906a67e:

  • File Amazon-AWS-user-data.ps1 — part of check-in [570b81898a] at 2018-06-10 14:17:14 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: 6521
# x-archived: 2016-11-18T08:39:38
# x-published: 2016-09-15T17:12:00
#
#
<powershell>

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

</powershell>