I know very little about Windows, but the problem seems to be that the
shell-local assumes a Posix shell (and also does shell). To workaround
this you can override the default "execute_command" (according to
Megan Marsh).

{
  "type":"shell-local",
  "execute_command": "Powershell.exe Move-Item {{.Script}}
{{.Script}}.ps1; Powershell.exe -File {{.Script}}.ps1",
  "inline": ["ovftool/ovftool.exe -tt=ova
vi://root:[email protected]/VMIMAGE ovaexport1.ova"]
}

This will result in that the following command will be executed:
- A temp file will be created with content of <inline> (which should
be an array).
- The script is moved to a new name with extension ps1 since
Powershell seems to require this.
- The script is executed.

Run the null builder against a running machine or a Vagrant box and try it out.

On 10 July 2017 at 09:29, James Elmes <[email protected]> wrote:
> that doesn't help unless you can explain the below to me, where is
> {{.Script}} predefined, and what would the below do? I just don't understand
> what the below achieves / how it works
>
>> "post-processors": [
>>     {
>>       "type": "shell-local",
>>       "execute_command": "Powershell.exe Move-Item {{.Script}}
>> {{.Script}}.ps1; Powershell.exe -File {{.Script}}.ps1",
>>       "inline": ["write-output HIIIIIIIII"]
>>     }
>
> --
> 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/91c5102f-1939-4881-9a1c-8829326c76d2%40googlegroups.com.
>
> 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/CALz9Rt_WgEf_Cdta9r_nhKnwE6WqFqJXAv7fjkQT8MbKSoTPrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to