I have Win PC run PS connects a device running ubuntu.
I could remotely ssh to ubuntu and run a command. for example,
plink -batch -ssh root@12.34.56.78 -pw 1234 touch x.txt
remote device will run “touch x.txt” and I can see x.txt is generated on remote device.
when I try to make above command run as background by doing this
Start-Job -ScriptBlock{plink -batch -ssh root@12.34.56.78 -pw 1234 touch x.txt}
Wow! it works great! you are expert. thank you so much.
more Questions:
when I use $ip=“12.34.56.78” and replace “-ssh root@12.34.56.78” with “-ssh root@$ip” it failed to work. how could I change the remote device ip address as a variable?
how could I get remote command console output redirects to a file of win PC?
I figured out $ip issue. $ip is not visible in -ScriptBlock{}. in order to make it visible. use $env:ip instead.
still did not figure out the remote console output to host PC yet.