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("https://gist.github.com/darkoperator/6152630/raw/c67de4f7cd780ba367cccbc2593f38d18ce6df89/instposhsshdev")
You can also use the following cmdlet to install as well:
Find-Module Posh-SSH | Install-Module
You will need an elevated PowerShell window and the Execution Policy to be set as Unrestricted to install the module and run the cmdlets.
To get the full list of the SSH cmdlet in PowerShell, run
Get-Command -Module Posh-SSH
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.
Latest posts by Kent Chen (see all)
- How To Enable and Use Fetch Files Feature in OneDrive to Access All Your Files Remotely - February 21, 2017
- Speed Up Email Search for Outlook and Gmail with Email Insight App - February 20, 2017
- How To Take Screenshot and Save it to OneDrive Automatically on Windows - February 17, 2017
Last updated: 06/14/2016