update powershell docs to include reference to the new winrmpassword template variable

This commit is contained in:
Megan Marsh 2018-03-16 14:25:09 -07:00
parent 4e32d0da24
commit de7d1430bd
1 changed files with 19 additions and 2 deletions

View File

@ -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