retieve variable from a script
hello:
i cannot retrieve variable have defined in script
$myip=read-host"enter remote ip"
# from source computer
function test{&'c:\test\test.ps1'}
icm -computername$myip-scriptblock${function:test}-argumentlist$myip
the result if : on:
#on remote computer have c:\test\test.ps1 these lines
param ($ip)
write-host "you on:$ip"
why cannot retrieve $ip...thank you
this need:
$myip = read-host"enter remote ip"
icm -computername $myip -scriptblock { c:\test\test.ps1 } -argumentlist $myip
\_(ツ)_/
Windows Server > Windows PowerShell
Comments
Post a Comment