This message was deleted.
# _general
s
This message was deleted.
n
Nope sorry, what happens if you try the same test manually using a Enter-PSsession from another device and the same command line. Packer on Azure is using WinRM so it's a good test.
j
i will give it a try and see what happens - good thinking 🙂
nice one - now i can reproduce it locally - as soon as i have the -wait param on my start-process, it never gets a finished response 🙂 thank you sir
n
Glad to help!!
j
Start-Process doesn't work with all app installs if you using the wait. This issue is that it may spawn another process, but the installer itself doesn't close it out before exiting. So you wait for ever.
Use this instead
$file = "<full path to the installer>" $UnattendedArgs = "<the args>" $pinfo = New-Object System.Diagnostics.ProcessStartInfo $pinfo.FileName = $file $pinfo.UseShellExecute = $false $pinfo.RedirectStandardOutput = $true $pinfo.RedirectStandardError = $true $pinfo.Arguments = $UnattendedArgs $p = New-Object System.Diagnostics.Process $p.StartInfo = $pinfo Try { $p.Start() | Out-Null $p.WaitForExit() $output = $p.StandardOutput.ReadToEnd() $output += $p.StandardError.ReadToEnd() $output Write-Verbose "Successfully executed" -Verbose Write-Verbose "Exit code: $($p.ExitCode)" -verbose } Catch { Write-Warning "Failed to execute" -Verbose } $p.Dispose()
j
@Jeremy Saunders that's exactly what it;s doing, i have found the process, and added a sleep + kill command in my PSADT tooklit command line - that should belt the prat of a thing. But i am also stealing your code for future reference coz this wont be the last
oh, thank you - forgot to say thank you
👍 1