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

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file