scope - Powershell Remote Variable Interpolation -


i having trouble passing variables remote sessions. about_remote_variable page, know can do:

$locallog = "windows powershell"  invoke-command -session $s -scriptblock {     get-winevent -logname $using:locallog | select -first 5; } 

and works enough. if following:

invoke-command -session $s -scriptblock {     $remotelog = $using:locallog;     get-winevent -logname $remotelog | select -first 5; } 

i error:

a using variable cannot retrieved. using variable can used invoke-command,  start-job, or inlinescript in script workflow. when used invoke-command,  using variable valid if script block invoked on remote computer.     + categoryinfo          : invalidoperation: (:) [], runtimeexception     + fullyqualifiederrorid : usingwithoutinvokecommand     + pscomputername        : mycomputer  

why fail? need understand because in real script trying pass many more variables , more complicated things.

thanks, bob


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -