PowerShell

PowerShell 7: Enable SSH Remoting

With Powershell 7, we can enable and use SSH Remoting. Unlike WinRM, SSH is more popular because it is a more familiar technology and is also available on other platforms. In this post I will show you how to easily enable SSH on PowerShell 7 with a few lines of code.

Install OpenSSH Client and Server

We now install SSH over the Internet. So you should make sure that your computer has access to the Internet.

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

Configuring the SSH Service

Next, we need to configure the SSH service. We set the Startup Type to Automatic.

Start-Service sshd -Verbose
Set-Service -Name sshd -StartupType 'Automatic' -Verbose

Enabling SSH Remoting

Now we install the PowerShell Remoting Tools, enable SSH and finally restart the service.

Install-Module -Name Microsoft.PowerShell.RemotingTools -Force -AllowClobber -Verbose
Enable-SSHRemoting 
Restart-Service sshd -Verbose

We are done. Now it’s time to test it.

Using SSH Remoting between SSH enabled Windows 11 Computers

I enter the following code to connect from computer A to computer B.

Enter-PSSession -HostName 192.168.0.104 -UserName admin

That’s it for today. Hope you enjoyed it!

Categories: PowerShell

Tagged as: ,

2 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.