How To Install and Use SSH with PowerShell


Looking forward, Microsoft will support for secure shell (SSH) with PowerShell but it’s still in the early planning phase, and there is no exact date yet as to when it will happen. Until then, we need to find another way to use SSH with PowerShell. Posh-SSH is one of those 3rd party modules available for automating tasks against systems using SSH protocol.


The module is hosted on GitHub and requires PowerShell 3.0 and .NET framework 4.0 to run. The quickest way to install the module is by running the following command in PowerShell window.

iex (New-Object Net.WebClient).DownloadString("")

PowerShell - install Posh SSh

You can also use the following cmdlet to install as well:

Find-Module Posh-SSH | Install-Module

PowerShell - install Posh-SSH

You will need an elevated PowerShell window and the Execution Policy to be set as Unrestricted to install the module and run the cmdlets.

SSH Cmdlets

To get the full list of the SSH cmdlet in PowerShell, run

Get-Command -Module Posh-SSH

PowerShell - list of SSH cmdlets

There are 8 cmdlets and a bunch of functions available for you to use directly, including creating new SSH or SFTP sessions, upload or download files or folders with SCP, or create or remove content from the SSH/SFTP host. To check technical details of each cmdlet or function, type

Get-Help cmdlet/function -Full

You can open multiple sessions at the same time so that you can control and automate tasks against more than one host without having to re-login to each one.

If you are interested in know more about SSH with PowerShell, check out this post on PowerShell Magazine, written by the author of Posh-SSH.



Please enter your comment!
Please enter your name here