Executing external program with PowerShell
Posted on 2014-02-10
I need a PowerShell script to (among other things) execute commands (contained in script.txt) on a remote system. The following works if I put it in a Windows command file (.cmd).
C:\PuTTY\plink.exe 10.10.10.5 -ssh -P 1234 -l username -pw xyz < %temp%\script.txt
How can I do this inline in PoweShell? I expect I'll need to use the invoke-expression comdlet, but can't figure out how to handle the parameters and input redirection.