You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1..2|start-rsjob -Name {$_} -ScriptBlock {
$var = 'this value'
new-object psobject -Property @{
Result=($_)
Test='Confirming $var is not substituted'
Something="Confirming $var is substituted"
}
}
Get-RSjob | Receive-RSJob
v2 produces this result:
Result Something Test
------ --------- ----
1 Confirming this value is substituted Confirming this value is not substituted
2 Confirming this value is substituted Confirming this value is not substituted
v3 & later produces correct results:
Result Something Test
------ --------- ----
1 Confirming this value is substituted Confirming $var is not substituted
2 Confirming this value is substituted Confirming $var is not substituted
The text was updated successfully, but these errors were encountered:
I believe I have a fix for this. Might be a more elegant way to do it, but it works.
The problem is in the ConvertScriptBlockV2 function and the fact that it always added strings to the built script using double-quotes. Instead the string needs to be re-added to the script using the same quoting as the source.
Great! I'll incorporate that and give it a run to test it. Hopefully I can include this as well as a couple of other things in an update later this week/weekend.
Try the following running PowerShell -version 2:
v2 produces this result:
v3 & later produces correct results:
The text was updated successfully, but these errors were encountered: