NetCmdlets gives administrators the ability to connect PowerShell scripts to remote Linux/Unix/MacOS systems, and execute commands remotely using standard networking protocols like SSH, Rexec, RShell, Telnet, and more! Through straightforward and easy-to-use cmdlets it is possible to securely automate and orchestrate remote systems from Windows.


For secure shell connections, NetCmdlets provides the Invoke-SSH cmdlet. Below is an example of connecting to a remote SSH server to execute the “ls” command.

PS> invoke-ssh -server myserver -user myuser -password mypassword -command ls
Do you want to trust the certificate presented?
The server has presented the key below.        
Fingerprint: 59:52:C8:DB:C8:3A:FE:CF:9D:02:E3:31:3A:2C:11:E4
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y   
Text                                                                      EOL 
----                                                                      --- 
AssemblyInfo.vb                                                          True 
Documents                                                                True 
EmptyFolder                                                              True 
Lance                                                                    True 
test.exe                                                                 True 
test.ps1                                                                 True 
test.txt                                                                 True 
v6tests                                                                  True 
v8tests                                                                  True

Invoke-Rexec and Invoke-Rshell

Rexec and Rshell (rsh.exe) already exist as command line applications, but until
now they did not return useful, easily scriptable objects in PowerShell.

Below is an example of using Invoke-Rexec to issue a directory listing command to
a remote rexec host:

PS> invoke-rexec -server server -user user -password pass 
-command "C:\WINDOWS\system32\cmd.exe /c dir c:\"
Text                                                                       EOL
----                                                                       --- 
 Volume in drive C has no label....                                       True 
 Volume Serial Number is 6C32-6256...                                     True 
...                                                                       True 
 Directory of c:\...                                                      True 
...                                                                       True 
12/13/2006  05:41 PM    <DIR>          Documents and Set...               True 
12/17/2006  12:04 PM    <DIR>          Inetpub...                         True 
01/09/2007  03:06 PM    <DIR>          Program Files...                   True 
12/17/2006  12:54 PM    <DIR>          share...                           True 
12/17/2006  12:29 PM    <DIR>          Sun...                             True 
01/21/2007  02:10 PM    <DIR>          TFTP-Root...                       True 
01/09/2007  03:08 PM    <DIR>          Virtual Machines...                True 
01/17/2007  03:02 PM    <DIR>          WINDOWS...                         True 
               7 File(s)        851,124 bytes...                          True 
              13 Dir(s)  15,440,244,736 bytes free...                     True 
              13 Dir(s)  15,440,244,736 bytes free...                     True 

Similarly, the Invoke-Rshell cmdlet gives the same output:

PS> invoke-rshell -server server -user user -password pass
-command "C:\WINDOWS\system32\cmd.exe /c dir c:\"


The Invoke-Telnet cmdlet may be used to execute a command via a telnet session. The cmdlet will connect, authenticate, wait for the specified Shell prompt to be returned by the server, and then execute the command. For instance:

PS> invoke-telnet -user test -password test -server MyServer 
-command ls -shellprompt bash-2.05a$

Download Now

NetCmdlets gives you an easy way to manage remote *NIX machines and devices directly from Windows PowerShell
scripts. For more information, help, and example scripts, please download NetCmdlets – pricing starts at free!