Skip to content

Instantly share code, notes, and snippets.

@kmf
Last active March 25, 2025 14:02
Show Gist options
  • Save kmf/78573e73e239b3afb09a22fc88431fd4 to your computer and use it in GitHub Desktop.
Save kmf/78573e73e239b3afb09a22fc88431fd4 to your computer and use it in GitHub Desktop.
WINDOWS-WINRM-SSHD
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
Get-NetFirewallRule -Name *ssh*
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
New-NetFirewallRule -Name winrm-insecure -DisplayName 'Winrm http' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 5985
New-NetFirewallRule -Name winrm-secure -DisplayName 'Winrm https' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 5986
Set-Item -Path WSMan:\localhost\Service\Auth\Basic -Value $true
Enable-WSManCredSSP -Role Server -Force
Set-Item -Path "WSMan:\localhost\Service\Auth\CredSSP" -Value $true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment