Home Dashboard Directory Help
Search

Powershell 3.0 Start-Process disregards -Wait Parameter when invoked Remotely by audio4ears


Status: 

Active


20
0
Sign in
to vote
Type: Bug
ID: 774903
Opened: 12/20/2012 4:03:19 PM
Access Restriction: Public
1
Workaround(s)
view
6
User(s) can reproduce this bug

Description

When Invoking a Start-Process command remotely it appears that the -Wait parameter is disregarded. This issue is new to Powershell 3.0. Powerhsell 2.0 handled the -Wait parameter correctly.

When the Start-Process cmd-let is ran locally in Powershell 3.0 the -Wait parameter functions as expected. The issue just occurs when invoked remotely.

Tested using: Windows Web Server 2008 x64 R2
Details
Sign in to post a comment.
Posted by Dave E 968 on 7/15/2013 at 3:40 AM
This is similar to http://connect.microsoft.com/PowerShell/feedback/details/776078/powershell-ignores-wait-request-on-start-process-when-ps-is-run-as-a-win32-job#tabs?
Sign in to post a workaround.
Posted by RDCF on 10/19/2013 at 6:32 PM
Use Start-Process with PassThru option of so that it outputs a Process object then use Wait-Process to wait on the completion of the process.

$p = Start-Process $cmd -Argumentlist $arg1 -PassThru
Wait-Process -InputObject $p
if ($p.ExitCode -gt 0)
{ Write-Warning "Process failed error " }