Hi Andy

You don't need to call waitOnExit explicitly. When you use -Wait switch
Start-Process waits for installer to finish.
Assuming your installer is not opening any dialog, you only need following.


Start-Process -FilePath "<Path to Execuable>" -ArgumentList "arg1","arg2"
 -Wait -WindowStyle Maximized -PassThru


On Fri, Feb 7, 2020, 3:49 AM Andy Burrows <[email protected]> wrote:

> Gautam, I;'ve read a post where you should run the process in the
> foreground as follows
>
>             $proc = Start-Process -FilePath "<Path to Execuable>"
>  -ArgumentList "arg1","arg2" -Wait -WindowStyle Maximized -PassThru
>             $proc.WaitForExit()
>
> haven't yet tried it, will let you know how we get on
>
> Cheers,
> Andy
>
> On Friday, 7 February 2020 03:14:28 UTC, Ravi Tiwary wrote:
>>
>> Hi Gautam,
>>
>> I am facing same issue, did you had a chance to find a solution for the
>> below?
>>
>> Thanks,
>> Ravi
>>
>> On Friday, January 24, 2020 at 1:20:10 AM UTC+5:30, Gomsy wrote:
>>>
>>> Hi,
>>>
>>> I am using packer with ebs-builder and powershell provisioner to build a
>>> Windows Server 2016 image. I am running a silent installer using following
>>> powershell command
>>> Start-Process "$InstallPath" -ArgumentList "$AnswerFilePath"  -Wait
>>> -NoNewWindow
>>>
>>> When running this command manually the command is exiting without any
>>> issue but when running from powershell provisioner in packer the packer
>>> build get stuck at this step.
>>> I ensured that the variables $InstallPath and $AnswerFilePath and
>>> properly set. The reason while I am running installer via Start-Process is
>>> because otherwise the installer exist immediately while installation
>>> happens in the background.
>>>
>>> Any idea what could be the issue?
>>>
>>> Thanks,
>>> -Gautam
>>>
>>>
>>> --
> 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/d5a0de8f-eaac-451a-91fb-6978812e9c22%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/d5a0de8f-eaac-451a-91fb-6978812e9c22%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAA7kr8BV%2BqfL_L5LsHtTXmZXJYb3_xkezO2rNhnLpN0UxRaboQ%40mail.gmail.com.

Reply via email to