Search

Invoke-Command OutVariable Parameter by Fitzroy87

Active

1
0
Sign in
to vote
Type: Bug
ID: 775921
Opened: 1/6/2013 2:07:28 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
Does the 'OutVariable' parameter of Invoke-Command work in PS 2.0?

In this example, $EC should contain the value returned by '$?':

Invoke-Command {& calc;$?} -OutVariable EC
write-host $EC

It works as expected in PS 3.0 (tested on Windows 7) but the $EC variable doesn't get created when run on PS 2.0 (tested on Windows XP & Windows 7).
Details (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

Yes, this happens in previous released versions
Reproduction Steps
Invoke-Command {& calc;$?} -OutVariable EC
write-host $EC
Expected Results
In my example, $EC should contain the value returned by '$?'.

It works as expected in PS 3.0 (tested on Windows 7) but the $EC variable doesn't get created when run on PS 2.0 (tested on Windows XP & Windows 7).
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.