Created
August 16, 2018 15:52
-
-
Save Kalki5/7360b5d59c2ce316f71d51eeb308a9fe to your computer and use it in GitHub Desktop.
OpenSSH on Windows server 2016 - Powershell script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-Location -Path 'C:\Program Files' | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
Invoke-WebRequest -Uri 'https://github.com/PowerShell/Win32-OpenSSH/releases/download/v7.7.2.0p1-Beta/OpenSSH-Win64.zip' -OutFile openssh.zip | |
Expand-Archive 'openssh.zip' -DestinationPath 'C:\Program Files\' | |
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path | |
$newpath = "$oldpath;C:\Program Files\OpenSSH-Win64" | |
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath | |
Set-Location -Path 'C:\Program Files\OpenSSH-Win64' | |
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1 | |
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH SSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 | |
net start sshd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment