From de7d1430bdcd9430e1b9a006b260871eabbc735f Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 16 Mar 2018 14:25:09 -0700 Subject: [PATCH] update powershell docs to include reference to the new winrmpassword template variable --- .../docs/provisioners/powershell.html.md | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/website/source/docs/provisioners/powershell.html.md b/website/source/docs/provisioners/powershell.html.md index a9c218638..d2707c76a 100644 --- a/website/source/docs/provisioners/powershell.html.md +++ b/website/source/docs/provisioners/powershell.html.md @@ -72,7 +72,16 @@ Optional parameters: - `environment_vars` (array of strings) - An array of key/value pairs to inject prior to the execute\_command. The format should be `key=value`. Packer injects some environmental variables by default into the - environment, as well, which are covered in the section below. + environment, as well, which are covered in the section below. If you are + using AWS and would like to use the randomly-generated unique + If you are running on AWS and would like to access the AWS-generated + Administrator password that Packer uses to connect to the instance via + WinRM, you can use the template variable `{{.WinRMPassword}}` to set this + as an environment variable. For example: + + ```json + "environment_vars": "WINRMPASS={{.WinRMPassword}}", + ``` - `execute_command` (string) - The command to use to execute the script. By default this is as follows: @@ -89,7 +98,15 @@ Optional parameters: - `elevated_user` and `elevated_password` (string) - If specified, the PowerShell script will be run with elevated privileges using the given - Windows user. + Windows user. If you are running a build on AWS and would like to run using + the AWS-generated password that Packer uses to connect to the instance via, + WinRM, you may do so by using the template variable {{.WinRMPassword}}. + For example: + + ``` json + "elevated_user": "Administrator", + "elevated_password": "{{.WinRMPassword}}", + ``` - `remote_path` (string) - The path where the script will be uploaded to in the machine. This defaults to "c:/Windows/Temp/script.ps1". This value must