Skip to content

Commit dd34e69

Browse files
Merge pull request #7502 from robinharwood/robinharwood-openssh-issue
Addressing user feedback in Get started with OpenSSH Server
2 parents 27bb22a + 3b92173 commit dd34e69

1 file changed

Lines changed: 101 additions & 13 deletions

File tree

WindowsServerDocs/administration/OpenSSH/OpenSSH_Install_FirstUse.md

Lines changed: 101 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Get started with OpenSSH Server for Windows
33
description: Learn how to install and connect to remote machines using the OpenSSH Client and Server for Windows.
4-
ms.date: 08/14/2025
4+
ms.date: 09/04/2025
55
ms.topic: quickstart
66
ms.author: roharwoo
77
author: robinharwood
@@ -82,7 +82,7 @@ To enable SSHD using PowerShell:
8282
1. Finally, run the following command to verify that the SSHD setup process automatically configured the firewall rule:
8383
8484
```powershell
85-
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
85+
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) {
8686
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
8787
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
8888
} else {
@@ -102,15 +102,15 @@ To enable SSHD using PowerShell:
102102
103103
To install the OpenSSH components on Windows Server devices:
104104
105-
1. Select **Start**, type _Optional Features_ in the search box, then select **Add an optional feature**.
105+
1. Select **Start**, type _Optional Features_ in the search box, then select **Optional Features**.
106106
107107
1. Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select **Views features**, then:
108108
109-
- Search for and select **OpenSSH Client**, select **Next**, then **Install**
109+
- Search for and select **OpenSSH Client**, then select **Add**
110110
111-
- Search for and select **OpenSSH Server**, select **Next**, then **Install**
111+
- Search for and select **OpenSSH Server**, then select **Add**
112112
113-
1. Open the **Services** desktop app. (Select **Start**, type _services.msc_ in the search box, and then select the **Service** app or press <kbd>ENTER</kbd>.)
113+
1. Open the **Services** desktop app. (Select **Start**, type _services.msc_ in the search box, and then select the **Services** app or press <kbd>ENTER</kbd>.)
114114
115115
1. In the details pane, double-click **OpenSSH SSH Server**.
116116
@@ -171,7 +171,7 @@ To install OpenSSH using PowerShell:
171171
Set-Service -Name sshd -StartupType 'Automatic'
172172
173173
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
174-
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
174+
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) {
175175
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
176176
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
177177
} else {
@@ -182,7 +182,95 @@ To install OpenSSH using PowerShell:
182182
---
183183
::: zone-end
184184
185-
::: zone pivot="windows-server-2022,windows-server-2019,windows-10"
185+
::: zone pivot="windows-server-2022"
186+
187+
## Install OpenSSH Server & Client
188+
189+
### [GUI](#tab/gui)
190+
191+
To install the OpenSSH components on Windows Server devices:
192+
193+
1. Select **Start**, type _Optional Feature_ in the search box, then select **Add an optional feature**.
194+
195+
1. Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select **Add a feature**, then:
196+
197+
- Search for **OpenSSH Client**, then select **Install**
198+
199+
- Search for **OpenSSH Server**, then select **Install**
200+
201+
1. Open the **Services** desktop app. (Select **Start**, type _services.msc_ in the search box, and then select the **Services** app or press <kbd>ENTER</kbd>.)
202+
203+
1. In the details pane, double-click **OpenSSH SSH Server**.
204+
205+
1. On the **General** tab, from the **Startup type** drop-down menu, select **Automatic** and then select **Ok**.
206+
207+
1. To start the service, select **Start**.
208+
209+
> [!NOTE]
210+
> Installing OpenSSH Server creates and enables a firewall rule named `OpenSSH-Server-In-TCP`. This rule allows inbound SSH traffic on port 22. If this rule isn't enabled and this port isn't open, connections are refused or reset.
211+
212+
### [PowerShell](#tab/powershell)
213+
214+
To install OpenSSH using PowerShell:
215+
216+
1. Run PowerShell as an Administrator.
217+
218+
1. Run the following cmdlet to make sure that OpenSSH is available:
219+
220+
```powershell
221+
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
222+
```
223+
224+
The command should return the following output if neither are already installed:
225+
226+
```powershell
227+
Name : OpenSSH.Client~~~~0.0.1.0
228+
State : NotPresent
229+
230+
Name : OpenSSH.Server~~~~0.0.1.0
231+
State : NotPresent
232+
```
233+
234+
1. After that, run the following cmdlets to install the server or client components as needed:
235+
236+
```powershell
237+
# Install the OpenSSH Client
238+
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
239+
240+
# Install the OpenSSH Server
241+
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
242+
```
243+
244+
Both commands should return the following output:
245+
246+
```powershell
247+
Path :
248+
Online : True
249+
RestartNeeded : False
250+
```
251+
252+
1. To start and configure OpenSSH Server for initial use, open an elevated PowerShell prompt (right-click, then select **Run as an administrator**), then run the following commands to start the `sshd service`:
253+
254+
```powershell
255+
# Start the sshd service
256+
Start-Service sshd
257+
258+
# OPTIONAL but recommended:
259+
Set-Service -Name sshd -StartupType 'Automatic'
260+
261+
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
262+
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) {
263+
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
264+
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
265+
} else {
266+
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
267+
}
268+
```
269+
270+
---
271+
::: zone-end
272+
273+
::: zone pivot="windows-server-2019,windows-10"
186274
187275
## Install OpenSSH Server & Client
188276
@@ -198,7 +286,7 @@ To install the OpenSSH components on Windows Server devices:
198286
199287
- Search for **OpenSSH Server**, then select **Install**
200288
201-
1. Open the **Services** desktop app. (Select **Start**, type _services.msc_ in the search box, and then select the **Service** app or press <kbd>ENTER</kbd>.)
289+
1. Open the **Services** desktop app. (Select **Start**, type _services.msc_ in the search box, and then select the **Services** app or press <kbd>ENTER</kbd>.)
202290
203291
1. In the details pane, double-click **OpenSSH SSH Server**.
204292
@@ -259,7 +347,7 @@ To install OpenSSH using PowerShell:
259347
Set-Service -Name sshd -StartupType 'Automatic'
260348
261349
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
262-
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
350+
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) {
263351
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
264352
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
265353
} else {
@@ -335,7 +423,7 @@ To disable SSHD using PowerShell:
335423
1. Finally, run the following command to disable the default SSHD firewall rule:
336424
337425
```powershell
338-
if ((Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
426+
if ((Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) {
339427
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' is being disabled."
340428
Disable-NetFirewallRule -Name 'OpenSSH-Server-In-TCP'
341429
} else {
@@ -382,7 +470,7 @@ To uninstall the OpenSSH components using PowerShell, follow these steps.
382470
1. Finally, run the following command to remove the firewall rule:
383471

384472
```powershell
385-
if ((Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
473+
if ((Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) {
386474
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' is being removed."
387475
Remove-NetFirewallRule -Name 'OpenSSH-Server-In-TCP'
388476
} else {
@@ -427,7 +515,7 @@ To uninstall the OpenSSH components using PowerShell, follow these steps.
427515
1. Finally, run the following command to remove the firewall rule:
428516

429517
```powershell
430-
if ((Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
518+
if ((Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) {
431519
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' is being removed."
432520
Remove-NetFirewallRule -Name 'OpenSSH-Server-In-TCP'
433521
} else {

0 commit comments

Comments
 (0)