views:

42

answers:

1

What are some of the best practices for writting scripts that will execute in a remote context?

For instance, I just discovered that built-in var $Profile doesn't exist during remote execution.

A: 

Script blocks don't act as closures, like they do normally:

$var = 5
$sb={ $var }
&$sb # 5
Start-Job $sb | Wait-Job | Receive-Job # nothing
Scott Weinstein