Microsoft announced that they will support SSH using PowerShell in Windows 10. Until now Microsoft has a good solution for this, there is a third party solutions called Posh-SSH. To use SSH in PowerShell you first have to install the Posh-SSH PowerShell Module from the PowerShell Gallery. Make sure you are running Windows 10 or you have the Windows Management Framework 5 installed.
If you want to use SSH with PowerShell 6, you read my blog here: Using SSH with PowerShell 6
You can now find the Posh-SSH Module and install it:
You now have several PowerShell SSH cmdlets available:
Now you can create a new SSH Session using the following cmdlet (Password based authentication)
New-SSHSession -ComputerName "thomasmaurer.azure.cloudapp.net" -Credential (Get-Credential)
You can now simply run commands against this session or use SCP to copy files.
Invoke-SSHCommand -Index 0 -Command "uname"
I hope this helps you using SSH with PowerShell. If you have any questions, please write it in the comments. Also check out my other blogs and see how SSH is integrated in Windows 10.Tags: Linux, Microsoft, Posh-SSH, PowerShell, PowerShell SSH, Remoting, SSH, SSH PowerShell, SSH PowerShell Module, Unix Last modified: April 4, 2019