It should work to run a powershell script with the execute_command which 
renames the file to .ps1 and runs it.

You can either run packer from the cmder screen or you have to put the dir 
where the sh.exe command is present is included in the search path in 
Powershell.


On Tuesday, July 18, 2017 at 10:06:28 AM UTC+2, James Elmes wrote:
>
> Thanks for your reply and explaining {{.script}. 
>
> I don't sh, I have just installed CMDER but not sure what to do next to be 
> honest.. not being a linux guru
>
> do i have to run the packer commands from this? if so wouldn't they be 
> completely different? i currently run using powershell
>
> Example:
> $env:PACKER_ESXI_VNC_PROBE_TIMEOUT="30s"
> $env:PACKER_LOG="1"
> $env:PACKER_LOG_PATH="packerlog.txt"
> Start-Process c:\packer\packer_config\packer.exe -ArgumentList "build 
> -var-file esxi_variables.json windowsonesxi4.json" -Wait -NoNewWindow
>
> On Saturday, 15 July 2017 03:32:55 UTC+10, Megan Marsh wrote:
>>
>> Hi James,
>>
>> Coming back online after a couple days away so apologies if you've 
>> already figured this out and I'm being redundant.  
>>
>> The operation definitely depends on sh being installed, so installing 
>> that will very likely solve your issue. 
>>
>> {{.Script}} is a Packer internal variable that references the location of 
>> the script in the tmp folder on the guest vm. This is implied in the docs, 
>> but it could probably be clearer that you can actually use {{.Script}} in 
>> your packer template as a way of referring to that script's absolute path.
>>
>> I'm guessing the reason the code Rickard pasted isn't working for you 
>> "out of the box" is because you don't have shell installed and you didn't 
>> apply the diff from my referenced comment beforehand (
>> https://github.com/hashicorp/packer/compare/shell_4140)? As you can see 
>> in there, Packer currently hardcodes the command as assuming you've got 
>> shell: `localCmd := exec.Command("sh", "-c", cmd.Command)`. 
>>
>> Hope this helps! We've definitely got some kinks to work out on Windows.
>>
>> On Wednesday, July 12, 2017 at 4:25:47 AM UTC-7, James Elmes wrote:
>>>
>>> thanks again Alex, i didn't really want to increase the moving parts 
>>>>>>> involved with the packer process but i may give this a go.
>>>>>>>
>>>>>>
>>> the other option is to just run it with the run command like the below. 
>>>
>>> $env:PACKER_ESXI_VNC_PROBE_TIMEOUT="30s"
>>> $env:PACKER_LOG="1"
>>> $env:PACKER_LOG_PATH="packerlog.txt"
>>> Start-Process c:\packer\packer_config\packer.exe -ArgumentList "build 
>>> -var-file esxi_variables.json windowsonesxi4.json" -Wait -NoNewWindow
>>> ovftool.exe -tt=ova vi://
>>> root:[email protected]/Windows2012R2v1-2017-07 ovaexport1112.ova
>>>
>>> ill let you know how this goes
>>>
>>> regards
>>>
>>> James
>>>
>>

-- 
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/67965f6e-d7c3-4fae-b537-3191d204bfb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to