Search

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

Active

4
0
Sign in
to vote
Type: Bug
ID: 774903
Opened: 12/20/2012 4:03:19 PM
Access Restriction: Public
0
Workaround(s)
1
User(s) can reproduce this bug
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 (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

No, this is new to the most recent version
Reproduction Steps
To test run the following line of code:

Replace <ServerName> with a server running Powershell 3.0

Invoke-Command -computername <ServerName> -credential $token -authentication CredSSP {$return = (Start-Process c:\windows\system32\cmd.exe -ArgumentList ("/c","Exit","/B","-1") -Wait -PassThru -WindowStyle Hidden) ; [convert]::ToInt32($return.exitcode) }
Expected Results
The output should return -1 as defined in the Arguments but unfortunately does not. Testing against a remote server running Powershell 2.0 will return -1
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.