How to configure powershell for OpenSSH instead of cmd

Abstract: Configure Windows PowerShell to use native OpenSSH by installing client and server capabilities, starting the sshd service, and setting it to automatic startup.

Created: 2026-09-24 by
To configure PowerShell for OpenSSH instead of Command Prompt, you must first install the OpenSSH Client and Server features via PowerShell. This involves using the Add-WindowsCapability cmdlet to enable SSH functionality within Windows 10 or 11. After installation, you need to start the SSH service and configure it to run automatically on startup. This setup allows you to leverage PowerShell’s advanced scripting capabilities alongside standard SSH commands, providing a more secure and flexible remote access experience compared to legacy tools like Telnet or basic CMD-based connections. By integrating OpenSSH directly into your PowerShell environment, you streamline administrative tasks and enhance security protocols across your network infrastructure.

Installing OpenSSH Components

The foundation of this configuration lies in installing the necessary OpenSSH components provided by Microsoft. These components are available as optional features in modern versions of Windows. You do not need third-party software; the native implementation is robust and fully supported. Open PowerShell with administrator privileges. This is critical because modifying system capabilities requires elevated permissions. If you open a standard user session, the installation commands will fail with an access denied error. To elevate your session, right-click the Start button and select "Windows PowerShell (Admin)" or search for PowerShell in the taskbar, right-click the result, and choose Run as administrator. Once the elevated window is open, execute the following command to install the OpenSSH Client:
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
This command queries the online Windows image and adds the client capability. The output should confirm that the operation succeeded. Next, if you intend to use this machine as an SSH server to accept incoming connections from other devices, you must also install the server component:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
For most users who only connect to remote servers, the client installation is sufficient. However, configuring the server is essential for those managing home labs or remote workstations. Ensure both installations complete without errors before proceeding to service configuration.

Configuring the SSH Service

After installation, the SSH service exists but is not running by default. You must start the service and configure its startup type to ensure it persists across reboots. This step integrates OpenSSH seamlessly into your system's background processes, allowing immediate connectivity without manual intervention. Start the SSH service by running the following command in your elevated PowerShell window:
Start-Service sshd
If the service starts successfully, you will see a status confirmation. However, starting the service manually does not guarantee it will launch after a restart. To automate this process, set the startup type to automatic. This ensures that the SSH daemon is ready to accept connections immediately upon booting the computer. Execute the following command to change the startup mode:
Set-Service -Name sshd -StartupType 'Automatic'
Additionally, you may want to verify the firewall rules. The installation process typically creates inbound firewall rules for port 22 automatically. However, verifying these rules prevents common connectivity issues. Check the firewall status with:
Get-NetFirewallRule -Name *ssh* | Select-Object Name, Enabled
All rules related to SSH should be enabled. If any are disabled, you can enable them manually using the Enable-NetFirewallRule cmdlet. This step is crucial for external accessibility, especially when connecting from outside your local network. For detailed guidance on external access, refer to our guide on Gaining SSH Access Outside Home Network Using PowerShell.

Verifying the Configuration

With the components installed and services configured, the final step is verification. You need to confirm that PowerShell recognizes the SSH commands and that the service is responding correctly. This validation ensures that your environment is ready for production use. Test the SSH client by attempting to connect to a known host. Replace user@hostname with valid credentials:
ssh user@hostname
If the connection initiates and prompts for a password or key authentication, the client is functioning correctly. If you encounter errors such as "command not found," verify that your PATH environment variable includes the directory where SSH binaries are located, typically C:\Program Files\OpenSSH. To verify the server side, check the service status again:
Get-Service sshd
The status should read "Running." You can also view the event logs for any SSH-related errors by checking the Windows Event Viewer under Applications and Services Logs > OpenSSH. This diagnostic approach helps identify subtle configuration issues that might not be apparent during initial testing.

Customizing SSH Behavior

PowerShell offers extensive customization options for SSH through configuration files. The primary configuration file is located at C:\ProgramData\ssh\sshd_config for the server and $HOME\.ssh\config for the client. Editing these files allows you to define specific behaviors, such as disabling password authentication in favor of key-based login, which is highly recommended for security. You can also map PowerShell aliases to SSH commands for quicker access. For example, you can create an alias in your PowerShell profile to simplify complex connection strings. Add the following line to your $PROFILE script:
Set-Alias -Name myserver -Value ssh [email protected]
This enhances productivity by reducing the number of keystrokes required for frequent connections. For more advanced configurations involving server-side settings, consult our article on Connect to OpenSSH Server on Windows using PowerShell.

Frequently Asked Questions

How do I uninstall OpenSSH if I made a mistake?

You can remove the OpenSSH features using the same Remove-WindowsCapability cmdlet used for installation. Simply replace Add with Remove in your previous commands and specify the exact name of the capability. This cleanly removes the binaries and associated registry entries.

Why is my SSH connection timing out even though the service is running?

This issue is often caused by firewall restrictions blocking port 22. Verify that your Windows Firewall allows inbound traffic on TCP port 22. Additionally, ensure that no external network firewalls or ISP blocks are interfering with the connection attempt.

Can I use SSH keys instead of passwords with PowerShell?

Yes, PowerShell fully supports SSH key-based authentication. You can generate keys using ssh-keygen and distribute the public key to remote servers. Configure your ~/.ssh/config file to specify the key path for specific hosts, automating the login process securely.

Does OpenSSH replace the entire Command Prompt interface?

No, OpenSSH is a toolset that runs within PowerShell or CMD. It does not replace the shell itself. You continue to use PowerShell for scripting and system management while utilizing SSH commands for network communications. Both shells can coexist and utilize SSH capabilities simultaneously.

What is the default port for OpenSSH on Windows?

The default port is 22, consistent with Linux and other Unix-like systems. If you need to change this for security reasons, you must modify the sshd_config file and update your firewall rules accordingly. Remember to specify the new port when connecting from clients using the -P flag.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More