Turns out google blocked me attaching the packer binary; I'll attach it to
the PR I linked above on GitHub

On Fri, May 4, 2018 at 10:01 AM, Megan Marsh <[email protected]>
wrote:

> I'm sorry to say it's not currently possible.  The shell-local
> post-processor has some hardcoded assumptions that the shell in question is
> sh:  https://github.com/hashicorp/packer/blob/
> 4dcf9d760b2fd549ddad85837e78e0ed64620a5e/post-processor/
> shell-local/communicator.go#L16
>
> But all is not lost. I have a pretty hefty rewrite of the code used for
> the shell-local provisioner and post-processors scheduled for the 1.3.0
> release (https://github.com/hashicorp/packer/pull/5956) which, among
> other things, should make this possible. I've attached a windows build of
> that PR if you'd like to test it out; I could use some community validation
> that it solves these kinds of less common cases.
>
> Example of running a powershell script on windows:
> Required customizations: env_var_format and execute_command
>
>       {
>           "type": "shell-local",
>           "environment_vars": ["SHELLLOCALTEST=ShellTest4"],
>           "execute_command": ["powershell.exe", "{{.Vars}} {{.Script}}"],
>           "env_var_format": "$env:%s=\"%s\"; ",
>           "script": "./scripts/example_ps.ps1"
>       }
>
> Example of running a powershell script on windows as "inline":
> Required customizations: env_var_format, tempfile_extension, and
> execute_command
>
>       {
>           "type": "shell-local",
>           "tempfile_extension": ".ps1",
>           "environment_vars": ["SHELLLOCALTEST=ShellTest5"],
>           "execute_command": ["powershell.exe", "{{.Vars}} {{.Script}}"],
>           "env_var_format": "$env:%s=\"%s\"; ",
>           "inline": ["write-output $env:SHELLLOCALTEST"]
>       }
>
> Thanks!
> Megan
>
>
> On Fri, May 4, 2018 at 9:49 AM, Dan Franciscus <[email protected]>
> wrote:
>
>> Hi all,
>>
>> Can someone give me an example of a proper way to run a PowerShell script
>> for a post processor on Windows? This does not seem to be working...
>>
>> "post-processors": [
>> {
>> "type": "shell-local",
>> "execute_command": "PowerShell -File A:/Test.ps1",
>> "inline": ["Test"]
>> }
>> ],
>>
>> --
>> This mailing list is governed under the HashiCorp Community Guidelines -
>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>> violation of those guidelines may result in your removal from this mailing
>> list.
>>
>> GitHub Issues: https://github.com/mitchellh/packer/issues
>> IRC: #packer-tool on Freenode
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Packer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/packer-tool/a641b13a-dee6-44ae-9b6d-4c0623bd8039%40googlegroups.com
>> <https://groups.google.com/d/msgid/packer-tool/a641b13a-dee6-44ae-9b6d-4c0623bd8039%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CAGPV1uqKPVOZaKHtJ3eAgM8UHMx0dMFJetJUG6SXQuKzJ2i9Zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to