Is there a way to get a list of all remote variables in a script block?
Consider the following:
$x = 1
$block = { Write-Host $using:x }
Invoke-Command -Session (New-PSSession) -ScriptBlock $block
Inside of $block, is there any way of getting a list of available $using: scoped variables?
$x = 1
$block = { Get-Variable }
Invoke-Command -Session (New-PSSession) -ScriptBlock $block
Does not yield $x as an available variable