> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/troubleshooting-and-resources/armory/how-tos/how-to-switch-packers-powershell-provisioner.md).

# How to Switch Packer's Powershell provisioner

### Introduction <a href="#introduction" id="introduction"></a>

When baking Windows AMIs, back-to-back bakes may fail on a seemingly random, intermittent basis. Since there are [multiple open Packer issues](https://github.com/hashicorp/packer/issues?q=is%3Aissue+is%3Aopen+powershell) with how Powershell scripts and their environment variables are handled, it has been observed that switching the Powershell provisioner from `winRM` to `SSH` addresses this issue.

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

Administrator access to the Spinnaker environment.

### Instructions <a href="#instructions" id="instructions"></a>

Apply the following changes to the Packer config:

* In the `variables` block, change: `"aws_winrm_username": null` to: `"aws_ssh_username": "Administrator"`\* `In the ```builders``` block, change: ```"communicator": "winrm"``` to: ```"communicator": "ssh"```*` In the `provisioner` block, add the following: `"execute_command": "powershell -executionpolicy bypass \"& { if (Test-Path variable:global:ProgressPreference){$global:ProgressPreference='SilentlyContinue'};. {{.Vars}}; &'{{.Path}}'; exit $LastExitCode }\""` Then, in the Spinnaker configuration manifest
* Under `virtualizationSettings`, change: `winRmUserName` to: `sshUserName: Administrator`\* Save and apply the changes to the environment
