Skip to content

Instantly share code, notes, and snippets.

@goffinet
Forked from Kalki5/installOpenSSH.ps1
Last active November 8, 2021 22:31
Show Gist options
  • Select an option

  • Save goffinet/9beef7682e65d963f484ca420dd6e892 to your computer and use it in GitHub Desktop.

Select an option

Save goffinet/9beef7682e65d963f484ca420dd6e892 to your computer and use it in GitHub Desktop.

Revisions

  1. goffinet revised this gist Jul 27, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion installOpenSSH.ps1
    Original file line number Diff line number Diff line change
    @@ -15,4 +15,6 @@ 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
    net start sshd

    Set-Service sshd -StartupType Automatic
  2. goffinet revised this gist Jul 27, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion installOpenSSH.ps1
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    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
    Invoke-WebRequest -Uri 'https://github.com/PowerShell/Win32-OpenSSH/releases/download/V8.6.0.0p1-Beta/OpenSSH-Win64.zip' -OutFile openssh.zip

    Expand-Archive 'openssh.zip' -DestinationPath 'C:\Program Files\'

  3. @Kalki5 Kalki5 created this gist Aug 16, 2018.
    18 changes: 18 additions & 0 deletions installOpenSSH.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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