Disable OpenSSH SSH Server (sshd) using PowerShell

OpenSSH SSH Server (sshd) is a popular implementation of the secure shell (SSH) protocol, which allows secure remote access to a system. In this case, we’ll explore how to disable the OpenSSH SSH Server using PowerShell in a more human-friendly way:

if (Get-Service $ServiceName -ErrorAction SilentlyContinue) {
Stop-Service $ServiceName
Set-Service $ServiceName -StartupType Disabled
echo “The service $ServiceName has been disabled.”
else {
echo “The service $ServiceName is not installed.”


Leave a comment

Your email address will not be published. Required fields are marked *

2 × 4 =