PowerShell scoping has defeated me again. Why does the code below return a null value instead of "blah"? How can I make it return "blah"?
$string = "blah"
$Session = New-PSSession -ComputerName "RandomRemoteComputer"
Invoke-Command -Session $Session -ScriptBlock{$string}I have tried it with the global scope specified on all variables. Same exact result.