{"id":7978,"date":"2020-12-17T15:43:58","date_gmt":"2020-12-17T20:43:58","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=7978"},"modified":"2020-12-17T15:44:08","modified_gmt":"2020-12-17T20:44:08","slug":"deploy-openssh-to-windows-server","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/","title":{"rendered":"Deploy OpenSSH to Windows Server"},"content":{"rendered":"\n<p>Yesterday I shared <a href=\"https:\/\/jdhitsolutions.com\/blog\/powershell-7\/7969\/deploy-openssh-server-to-windows-10\/\" target=\"_blank\" rel=\"noreferrer noopener\">some PowerShell ideas for remotely setting up the server component of <em>ssh<\/em><\/a><em> <\/em>on a remote Windows 10 system. This would allow you to establish an ssh session to the desktop or even use PowerShell remoting over ssh. Next, we need to look at doing the same thing for Windows Servers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Windows Server 2019<\/h2>\n\n\n\n<p>If you are using Windows Server 2019, you can use the same code I used with Windows 10, at least based on my experiences. Windows Server 2019 includes the OpenSSH.Server capability that you can install with Add-WindowsCapability. I was able to use the same deployment script I used with Windows 10 to install PowerShell 7 and sshd. The only change I made was to the Write-Progress activity.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$prog\u00a0=\u00a0@{\n\u00a0\u00a0\u00a0\u00a0Activity\u00a0=\u00a0\"Deploy\u00a0SSH\u00a0Server\u00a0to\u00a0Windows\u00a010\/Windows\u00a0Server\u00a02019\"\n\u00a0\u00a0\u00a0\u00a0Status\u00a0=\u00a0$Computername.toUpper()\n\u00a0\u00a0\u00a0\u00a0CurrentOperation\u00a0=\u00a0\"\"\n\u00a0\u00a0\u00a0\u00a0PercentComplete\u00a0=\u00a00\n}<\/code><\/pre>\n\n\n\n<p>Otherwise, everything ran the same and in minutes PowerShell 7 and ssh remoting were ready to go.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"460\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-1024x460.png\" alt=\"Windows Server 2019 PowerShell remoting over ssh\" class=\"wp-image-7979\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-1024x460.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-300x135.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-768x345.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-1536x690.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-850x382.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png 1623w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Windows Server 2016<\/h2>\n\n\n\n<p>Installing for Windows Server 2016 is a bit different. According to the Microsoft documentation that I could find, you need to install the latest bits from GitHub. You can do that with Invoke-Webrequest. Although before you do anything, you will most likely need to configure network security.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">[Net.ServicePointManager]::SecurityProtocol\u00a0=\u00a0[Net.SecurityProtocolType]::Tls12<\/code><\/pre>\n\n\n\n<p>If you don't do this on Windows Server 2016, you'll get errors trying to connect to GitHub and the PowerShell Gallery. Once the zip file is downloaded, you can extract it and then run the setup script. Here's the server-focused PowerShell script.<\/p>\n\n\n\n<pre title=\"Setup-SSHWinServer.ps1\" class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"><em>#requires\u00a0-version\u00a05.1<\/em>\n\n<em>&lt;#<\/em>\n<em>\u00a0\u00a0\u00a0\u00a0setup\u00a0SSHD\u00a0on\u00a0Windows\u00a0Server\u00a02016<\/em>\n<em>\u00a0\u00a0\u00a0\u00a0https:\/\/github.com\/PowerShell\/Win32-OpenSSH\/wiki\/Install-Win32-OpenSSH<\/em>\n\n<em>\u00a0\u00a0\u00a0\u00a0This\u00a0script\u00a0is\u00a0designed\u00a0to\u00a0be\u00a0run\u00a0remotely\u00a0using\u00a0Invoke-Command<\/em>\n\n<em>\u00a0\u00a0\u00a0\u00a0Sample\u00a0usage:<\/em>\n<em>\u00a0\u00a0\u00a0\u00a0Verbose\u00a0and\u00a0Whatif<\/em>\n<em>\u00a0\u00a0\u00a0\u00a0invoke-command\u00a0-FilePath\u00a0.\\Setup-SSHServer2.ps1\u00a0-ComputerName\u00a0srv1\u00a0-cred\u00a0$admin\u00a0-ArgumentList\u00a0@(\"Continue\",$True)<\/em>\n\n<em>\u00a0\u00a0\u00a0\u00a0Verbose<\/em>\n<em>\u00a0\u00a0\u00a0\u00a0invoke-command\u00a0-FilePath\u00a0.\\Setup-SSHServer2.ps1\u00a0-ComputerName\u00a0srv1\u00a0-cred\u00a0$admin\u00a0-ArgumentList\u00a0@(\"Continue\")<\/em>\n<em>#><\/em>\n\n[cmdletbinding(<em>SupportsShouldProcess<\/em>)]\nParam([string]$VerboseOption\u00a0=\u00a0\"SilentlyContinue\",\u00a0[bool]$WhatIfOption\u00a0=\u00a0$False)\n\n$VerbosePreference\u00a0=\u00a0$VerboseOption\n$WhatIfPreference\u00a0=\u00a0$WhatIfOption\n\n[Net.ServicePointManager]::SecurityProtocol\u00a0=\u00a0[Net.SecurityProtocolType]::Tls12\n$url\u00a0=\u00a0'https:\/\/github.com\/PowerShell\/Win32-OpenSSH\/releases\/latest\/'\n$request\u00a0=\u00a0[System.Net.WebRequest]::Create($url)\n$request.AllowAutoRedirect\u00a0=\u00a0$false\n$response\u00a0=\u00a0$request.GetResponse()\n$dl\u00a0=\u00a0$([String]$response.GetResponseHeader(\"Location\")).Replace('tag',\u00a0'download')\u00a0+\u00a0'\/OpenSSH-Win64.zip'\n\n$zip\u00a0=\u00a0\"C:\\OpenSSH64.zip\"\nWrite-Verbose\u00a0\"download\u00a0SSH\u00a0from\u00a0$dl\u00a0to\u00a0$zip\"\nif\u00a0($pscmdlet.ShouldProcess($dl,\"Downloading\u00a0OpenSSH-Win64\u00a0Package\"))\u00a0{\n\u00a0\u00a0\u00a0\u00a0Try\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Invoke-WebRequest\u00a0-Uri\u00a0$dl\u00a0-OutFile\u00a0$zip\u00a0-DisableKeepAlive\u00a0-ErrorAction\u00a0Stop\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0Catch\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Throw\u00a0$_\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0if\u00a0(Test-Path\u00a0$zip)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Extract\u00a0zip\u00a0file\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Expand-Archive\u00a0$zip\u00a0-DestinationPath\u00a0\"c:\\Program\u00a0Files\"\u00a0-force\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0else\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Return\u00a0\"zip\u00a0file\u00a0failed\u00a0to\u00a0download\"\n\u00a0\u00a0\u00a0\u00a0}\n}\n\nWrite-Verbose\u00a0\"Install\u00a0SSH\"\nif\u00a0($pscmdlet.ShouldProcess(\"install-sshd.ps1\",\u00a0\"Execute\"))\u00a0{\n\u00a0\u00a0\u00a0\u00a0Push-Location\n\u00a0\u00a0\u00a0\u00a0Set-Location\u00a0-Path\u00a0'C:\\Program\u00a0Files\\OpenSSH-Win64\\'\n\u00a0\u00a0\u00a0\u00a0.\u00a0.\\install-sshd\n\u00a0\u00a0\u00a0\u00a0Pop-Location\n}\n\nWrite-Verbose\u00a0\"Set\u00a0sshd\u00a0to\u00a0auto\u00a0start\"\nTry\u00a0{\n\u00a0\u00a0\u00a0\u00a0if\u00a0($pscmdlet.ShouldProcess(\"sshd\",\u00a0\"Configure\u00a0service\"))\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Set-Service\u00a0-Name\u00a0sshd\u00a0-StartupType\u00a0Automatic\u00a0-ErrorAction\u00a0stop\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Start\u00a0the\u00a0sshd\u00a0service\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Start-Service\u00a0-Name\u00a0sshd\u00a0-ErrorAction\u00a0Stop\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Get-Service\u00a0sshd\u00a0|\u00a0Select-Object\u00a0-Property\u00a0*\u00a0|\u00a0Out-String\u00a0|\u00a0Write-Verbose\n\u00a0\u00a0\u00a0\u00a0}\n}\nCatch\u00a0{\n\u00a0\u00a0\u00a0\u00a0Write-Warning\u00a0\"There\u00a0was\u00a0a\u00a0problem\u00a0configuring\u00a0the\u00a0sshd\u00a0service.\"\n}\n\nWrite-Verbose\u00a0\"Add\u00a0the\u00a0firewall\u00a0rule\"\nif\u00a0($pscmdlet.ShouldProcess(\"sshd\",\u00a0\"Add\u00a0firewall\u00a0rule\"))\u00a0{\n\u00a0\u00a0\u00a0\u00a0Try\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$rule\u00a0=\u00a0New-NetFirewallRule\u00a0-Name\u00a0sshd\u00a0-DisplayName\u00a0'OpenSSH\u00a0Server\u00a0(sshd)'\u00a0-Enabled\u00a0True\u00a0-Direction\u00a0Inbound\u00a0-Protocol\u00a0TCP\u00a0-Action\u00a0Allow\u00a0-LocalPort\u00a022\u00a0-ErrorAction\u00a0Stop\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0($rule\u00a0|\u00a0Out-String)\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0Catch\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Throw\u00a0$_\n\u00a0\u00a0\u00a0\u00a0}\n}\n\nif\u00a0(-Not\u00a0$WhatIfOption)\u00a0{\n\u00a0\u00a0\u00a0\u00a0<em>#only\u00a0display\u00a0the\u00a0summary\u00a0if\u00a0not\u00a0using\u00a0-WhatIf<\/em>\n\u00a0\u00a0\u00a0\u00a0$msg\u00a0=\u00a0@\"\n\nSSH\u00a0setup\u00a0complete.\u00a0Edit\u00a0$ENV:ProgramData\\ssh\\sshd_config\u00a0for\u00a0additional\u00a0configurations\u00a0options\nor\u00a0to\u00a0enable\u00a0remoting\u00a0under\u00a0PowerShell\u00a07.\n\nYou\u00a0will\u00a0need\u00a0to\u00a0restart\u00a0the\u00a0sshd\u00a0service\u00a0for\u00a0changes\u00a0to\u00a0take\u00a0effect.\n\n\"@\n\u00a0\u00a0\u00a0\u00a0Write-Host\u00a0$msg\u00a0-ForegroundColor\u00a0green\n}\n\nWrite-Verbose\u00a0\"Ending\u00a0SSHD\u00a0setup\u00a0process.\"<\/code><\/pre>\n\n\n\n<p>As with the Windows 10 version of the script, this is designed to be run remotely using Invoke-Command.  And of course, I have a control script.<\/p>\n\n\n\n<pre title=\"Deploy-SSHWinServer.ps1\" class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"><em>#requires\u00a0-version\u00a05.1<\/em>\n\n<em>#Deployment\u00a0control\u00a0script\u00a0to\u00a0setup\u00a0SSH\u00a0server\u00a0on\u00a0a\u00a0remote\u00a0Windows\u00a0Server\u00a02016<\/em>\n<em>#It\u00a0is\u00a0assumed\u00a0PowerShell\u00a07\u00a0is,\u00a0or\u00a0will\u00a0be,\u00a0installed.<\/em>\n\n[cmdletbinding(<em>SupportsShouldProcess<\/em>)]\nParam(\n\u00a0\u00a0\u00a0\u00a0[Parameter(<em>Position<\/em>\u00a0=\u00a00,\u00a0<em>Mandatory<\/em>)]\n\u00a0\u00a0\u00a0\u00a0[string]$Computername,\n\u00a0\u00a0\u00a0\u00a0[pscredential]$Credential,\n\u00a0\u00a0\u00a0\u00a0[switch]$InstallPowerShell\n)\n\n<em>#remove\u00a0parameters\u00a0from\u00a0PSBoundparameter\u00a0that\u00a0don't\u00a0apply\u00a0to\u00a0New-PSSession<\/em>\nif\u00a0($PSBoundParameters.ContainsKey(\"InstallPowerShell\"))\u00a0{\n\u00a0\u00a0\u00a0\u00a0[void]($PSBoundParameters.remove(\"InstallPowerShell\"))\n}\n\nif\u00a0($PSBoundParameters.ContainsKey(\"WhatIf\"))\u00a0{\n\u00a0\u00a0\u00a0\u00a0[void]($PSBoundParameters.remove(\"WhatIf\"))\n}\n\n<em>#parameters\u00a0for\u00a0Write-Progress<\/em>\n$prog\u00a0=\u00a0@{\n\u00a0\u00a0\u00a0\u00a0Activity\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0=\u00a0\"Deploy\u00a0SSH\u00a0Server\u00a0to\u00a0Windows\u00a0Server\u00a02016\"\n\u00a0\u00a0\u00a0\u00a0Status\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0=\u00a0$Computername.toUpper()\n\u00a0\u00a0\u00a0\u00a0CurrentOperation\u00a0=\u00a0\"\"\n\u00a0\u00a0\u00a0\u00a0PercentComplete\u00a0\u00a0=\u00a00\n}\n<em>#create\u00a0the\u00a0PSSession<\/em>\nTry\u00a0{\n\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Creating\u00a0a\u00a0PSSession\u00a0to\u00a0$Computername\"\n\u00a0\u00a0\u00a0\u00a0$prog.CurrentOperation\u00a0=\u00a0\"Creating\u00a0a\u00a0temporary\u00a0PSSession\"\n\u00a0\u00a0\u00a0\u00a0$prog.PercentComplete\u00a0=\u00a010\n\u00a0\u00a0\u00a0\u00a0Write-Progress\u00a0@prog\n\u00a0\u00a0\u00a0\u00a0$sess\u00a0=\u00a0New-PSSession\u00a0@PSBoundParameters\u00a0-ErrorAction\u00a0Stop\n}\nCatch\u00a0{\n\u00a0\u00a0\u00a0\u00a0Throw\u00a0$_\n}\n\nif\u00a0($sess)\u00a0{\n\u00a0\u00a0\u00a0\u00a0if\u00a0($InstallPowerShell)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Installing\u00a0PowerShell\u00a07\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$prog.currentOperation\u00a0=\u00a0\"Installing\u00a0PowerShell\u00a07\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$prog.percentComplete\u00a0=\u00a025\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Progress\u00a0@prog\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<em>#install\u00a0PowerShell<\/em>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if\u00a0($pscmdlet.ShouldProcess($Computername.toUpper(),\u00a0\"Install\u00a0PowerShell\u00a07\"))\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Invoke-Command\u00a0-ScriptBlock\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<em>#need\u00a0to\u00a0set\u00a0security\u00a0protocol\u00a0to\u00a0Tls12\u00a0for\u00a0Windows\u00a0Server\u00a02016\u00a0otherwise\u00a0the\u00a0installs\u00a0will\u00a0fail<\/em>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Setting\u00a0network\u00a0security\u00a0to\u00a0Tls12\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[Net.ServicePointManager]::SecurityProtocol\u00a0=\u00a0[Net.SecurityProtocolType]::Tls12\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Using\u00a0Security\u00a0Protocol\u00a0$([Net.ServicePointManager]::SecurityProtocol)\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[void](Install-PackageProvider\u00a0-Name\u00a0nuget\u00a0-force\u00a0-forcebootstrap\u00a0-minimumversion\u00a0'2.8.5.201')\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Install-Module\u00a0PSReleaseTools\u00a0-Force\u00a0-Scope\u00a0AllUsers\u00a0-Repository\u00a0PSGallery\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Install-PowerShell\u00a0-EnableRemoting\u00a0-EnableContextMenu\u00a0-Mode\u00a0Quiet\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0-Session\u00a0$sess\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<em>#Installing\u00a0PowerShell\u00a0may\u00a0break\u00a0the\u00a0session\u00a0so\u00a0rebuild\u00a0it\u00a0if\u00a0necessary<\/em>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if\u00a0($sess.state\u00a0-eq\u00a0'Broken')\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Rebuilding\u00a0the\u00a0temporary\u00a0PSSession\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$sess\u00a0=\u00a0New-PSSession\u00a0@PSBoundParameters\u00a0-ErrorAction\u00a0Stop\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0<em>#whatif<\/em>\n\u00a0\u00a0\u00a0\u00a0}\u00a0<em>#if\u00a0install\u00a0PowerShell\u00a07<\/em>\n\n\u00a0\u00a0\u00a0\u00a0<em>#setup\u00a0SSH<\/em>\n\u00a0\u00a0\u00a0\u00a0$prog.currentOperation\u00a0=\u00a0\"Installing\u00a0OpenSSH\u00a0Server\"\n\u00a0\u00a0\u00a0\u00a0$prog.percentComplete\u00a0=\u00a050\n\u00a0\u00a0\u00a0\u00a0Write-Progress\u00a0@prog\n\u00a0\u00a0\u00a0\u00a0Invoke-Command\u00a0-FilePath\u00a0.\\Setup-SSHServer2.ps1\u00a0-Session\u00a0$sess\u00a0-ArgumentList\u00a0@($VerbosePreference,\u00a0$WhatIfPreference)\n\n\u00a0\u00a0\u00a0\u00a0<em>#copy\u00a0the\u00a0sshd_config\u00a0file.\u00a0This\u00a0assumes\u00a0you've\u00a0installed\u00a0PowerShell\u00a07\u00a0on\u00a0the\u00a0remote\u00a0computer<\/em>\n\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Copying\u00a0sshd_config\u00a0to\u00a0target\"\n\u00a0\u00a0\u00a0\u00a0$prog.currentOperation\u00a0=\u00a0\"Copying\u00a0default\u00a0sshd_config\u00a0to\u00a0target\"\n\u00a0\u00a0\u00a0\u00a0$prog.percentcomplete\u00a0=\u00a060\n\u00a0\u00a0\u00a0\u00a0Write-Progress\u00a0@prog\n\u00a0\u00a0\u00a0\u00a0Copy-Item\u00a0-Path\u00a0.\\sshd_config_default\u00a0-Destination\u00a0$env:ProgramData\\ssh\\sshd_config\u00a0-ToSession\u00a0$sess\n\n\u00a0\u00a0\u00a0\u00a0<em>#restart\u00a0the\u00a0service<\/em>\n\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Restarting\u00a0the\u00a0sshd\u00a0service\u00a0on\u00a0the\u00a0target\"\n\u00a0\u00a0\u00a0\u00a0$prog.currentOperation\u00a0=\u00a0\"Restarting\u00a0the\u00a0ssh\u00a0service\u00a0target\"\n\u00a0\u00a0\u00a0\u00a0$prog.percentComplete\u00a0=\u00a075\n\u00a0\u00a0\u00a0\u00a0Write-Progress\u00a0@prog\n\u00a0\u00a0\u00a0\u00a0if\u00a0($pscmdlet.ShouldProcess(\"sshd\",\u00a0\"Restart\u00a0service\"))\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Invoke-Command\u00a0{\u00a0Restart-Service\u00a0-Name\u00a0sshd\u00a0}\u00a0-Session\u00a0$sess\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Removing\u00a0the\u00a0temporary\u00a0PSSession\"\n\u00a0\u00a0\u00a0\u00a0$prog.currentOperation\u00a0=\u00a0\"Removing\u00a0temporary\u00a0PSSession\"\n\u00a0\u00a0\u00a0\u00a0$prog.percentComplete\u00a0=\u00a090\n\u00a0\u00a0\u00a0\u00a0Write-Progress\u00a0@prog\n\u00a0\u00a0\u00a0\u00a0$sess\u00a0|\u00a0Remove-PSSession\n\n\u00a0\u00a0\u00a0\u00a0Write-Progress\u00a0@prog\u00a0-Completed\n\u00a0\u00a0\u00a0\u00a0$msg\u00a0=\u00a0@\"\n\nSSH\u00a0Server\u00a0deployment\u00a0complete\u00a0for\u00a0$($Computername.toUpper()).\n\nIf\u00a0PowerShell\u00a07\u00a0is\u00a0installed\u00a0remotely,\u00a0you\u00a0should\u00a0be\u00a0able\u00a0to\u00a0test\nwith\u00a0an\u00a0expression\u00a0like:\n\nEnter-PSSession\u00a0-hostname\u00a0$Computername\u00a0-username\u00a0&lt;user>\u00a0-sshtransport\n\n\"@\n\n\u00a0\u00a0\u00a0\u00a0Write-Host\u00a0$msg\u00a0-ForegroundColor\u00a0yellow\n}\u00a0<em>#if\u00a0$sess<\/em>\nelse\u00a0{\n\u00a0\u00a0\u00a0\u00a0<em>#this\u00a0should\u00a0never\u00a0get\u00a0called<\/em>\n\u00a0\u00a0\u00a0\u00a0Write-Warning\u00a0\"Failed\u00a0to\u00a0create\u00a0a\u00a0temporary\u00a0session\u00a0to\u00a0$Computername.\"\n}<\/code><\/pre>\n\n\n\n<p>The script supports -Verbose and -WhatIf.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/deploy-ssh-winserver.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/deploy-ssh-winserver-1024x551.png\" alt=\"\" class=\"wp-image-7981\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/deploy-ssh-winserver-1024x551.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/deploy-ssh-winserver-300x161.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/deploy-ssh-winserver-768x413.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/deploy-ssh-winserver-1536x826.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/deploy-ssh-winserver-2048x1102.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>The script will copy the sshd_config_default file which you can grab from the previous post. Once in place, remoting with ssh in PowerShell 7 is a breeze.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/invoke-command-over-ssh.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"155\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/invoke-command-over-ssh-1024x155.png\" alt=\"\" class=\"wp-image-7983\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/invoke-command-over-ssh-1024x155.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/invoke-command-over-ssh-300x45.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/invoke-command-over-ssh-768x116.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/invoke-command-over-ssh-1536x232.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/invoke-command-over-ssh-850x128.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/invoke-command-over-ssh.png 2028w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Next Steps<\/h2>\n\n\n\n<p>You should test all of this code in a non-production environment and adjust as necessary. Anytime you play with remoting, you run the risk of leaving yourself vulnerable. Part of this process should include learning more about ssh. All I've done is get it installed and able to work with PowerShell. There is much more to ssh<\/p>\n\n\n\n<p>Comments and questions welcome.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday I shared some PowerShell ideas for remotely setting up the server component of ssh on a remote Windows 10 system. This would allow you to establish an ssh session to the desktop or even use PowerShell remoting over ssh. Next, we need to look at doing the same thing for Windows Servers. Windows Server&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"new on the blog: Deploy OpenSSH to Windows Server #PowerShell #PS7Now","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,610,8],"tags":[624,613],"class_list":["post-7978","post","type-post","status-publish","format-standard","hentry","category-powershell","category-powershell-7","category-scripting","tag-ps7now","tag-ssh"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Deploy OpenSSH to Windows Server &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"Here are some techniques and PowerShell code for deploying PowerShell 7 and OpenSSH to Windows-based servers.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deploy OpenSSH to Windows Server &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Here are some techniques and PowerShell code for deploying PowerShell 7 and OpenSSH to Windows-based servers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-17T20:43:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-17T20:44:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-1024x460.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Deploy OpenSSH to Windows Server\",\"datePublished\":\"2020-12-17T20:43:58+00:00\",\"dateModified\":\"2020-12-17T20:44:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/\"},\"wordCount\":353,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/win2019-psssh-1024x460.png\",\"keywords\":[\"PS7Now\",\"SSH\"],\"articleSection\":[\"PowerShell\",\"PowerShell 7\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/\",\"name\":\"Deploy OpenSSH to Windows Server &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/win2019-psssh-1024x460.png\",\"datePublished\":\"2020-12-17T20:43:58+00:00\",\"dateModified\":\"2020-12-17T20:44:08+00:00\",\"description\":\"Here are some techniques and PowerShell code for deploying PowerShell 7 and OpenSSH to Windows-based servers.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/win2019-psssh.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/win2019-psssh.png\",\"width\":1623,\"height\":729},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7978\\\/deploy-openssh-to-windows-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deploy OpenSSH to Windows Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Deploy OpenSSH to Windows Server &#8226; The Lonely Administrator","description":"Here are some techniques and PowerShell code for deploying PowerShell 7 and OpenSSH to Windows-based servers.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/","og_locale":"en_US","og_type":"article","og_title":"Deploy OpenSSH to Windows Server &#8226; The Lonely Administrator","og_description":"Here are some techniques and PowerShell code for deploying PowerShell 7 and OpenSSH to Windows-based servers.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/","og_site_name":"The Lonely Administrator","article_published_time":"2020-12-17T20:43:58+00:00","article_modified_time":"2020-12-17T20:44:08+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-1024x460.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Deploy OpenSSH to Windows Server","datePublished":"2020-12-17T20:43:58+00:00","dateModified":"2020-12-17T20:44:08+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/"},"wordCount":353,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-1024x460.png","keywords":["PS7Now","SSH"],"articleSection":["PowerShell","PowerShell 7","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/","name":"Deploy OpenSSH to Windows Server &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh-1024x460.png","datePublished":"2020-12-17T20:43:58+00:00","dateModified":"2020-12-17T20:44:08+00:00","description":"Here are some techniques and PowerShell code for deploying PowerShell 7 and OpenSSH to Windows-based servers.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/win2019-psssh.png","width":1623,"height":729},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7978\/deploy-openssh-to-windows-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Deploy OpenSSH to Windows Server"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":7969,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-7\/7969\/deploy-openssh-server-to-windows-10\/","url_meta":{"origin":7978,"position":0},"title":"Deploy OpenSSH Server to Windows 10","author":"Jeffery Hicks","date":"December 16, 2020","format":false,"excerpt":"PowerShell 7 offers a number of compelling reasons to adopt it. One of the best is support for SSH as a PowerShell remoting protocol. Unfortunately, this is not a topic that typically comes up for Windows-centric IT Pros. I know this is definitely true in my case, and a deficiency\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":8492,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8492\/searching-for-powershell-with-cim\/","url_meta":{"origin":7978,"position":1},"title":"Searching for PowerShell with CIM","author":"Jeffery Hicks","date":"July 15, 2021","format":false,"excerpt":"Yesterday I shared a script that you could use to inventory systems for Windows PowerShell and PowerShell 7 installations. This should work for most people who install PowerShell 7 with the provided installer. But, as has been pointed out more than once to me, this won't detect any side-loaded or\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/pwsh-cim3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/pwsh-cim3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/pwsh-cim3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/pwsh-cim3.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":8482,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8482\/revisiting-powershell-version-inventory\/","url_meta":{"origin":7978,"position":2},"title":"Revisiting PowerShell Version Inventory","author":"Jeffery Hicks","date":"July 13, 2021","format":false,"excerpt":"In the past, I've shared a variety of PowerShell approaches that you can use to inventory what versions of PowerShell are installed. But I think I now have the best approach short of searching the hard drive for powershell.exe and pwsh.exe, which I suppose is still a possibility and something\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/get-psinstalled-4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/get-psinstalled-4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/get-psinstalled-4.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/07\/get-psinstalled-4.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5895,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5895\/another-look-at-powershell-core-version-information\/","url_meta":{"origin":7978,"position":3},"title":"Another Look at PowerShell Core Version Information","author":"Jeffery Hicks","date":"February 8, 2018","format":false,"excerpt":"As PowerShell Core begins to spread into our world, and as we start thinking about working and scripting cross-platform, it will be useful to know what type of platform you are running on. The built in $PSVersionTable is an obvious place to start. On PowerShell Core there are also some\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-5.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-5.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-5.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":7257,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7257\/cross-platform-powershell-profiles-with-windows-terminal\/","url_meta":{"origin":7978,"position":4},"title":"Cross Platform PowerShell Profiles with Windows Terminal","author":"Jeffery Hicks","date":"February 13, 2020","format":false,"excerpt":"Earlier this week I shared my techniques for creating a Windows Terminal profile that would open a remote PowerShell session. But with PowerShell 7, I can also connect to non-Windows machines using SSH. So why not extend my code to allow connecting to a Linux box? Before you try anything\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7848,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7848\/parsing-ssh-known-hosts-with-powershell-and-regular-expressions\/","url_meta":{"origin":7978,"position":5},"title":"Parsing ssh Known Hosts with PowerShell and Regular Expressions","author":"Jeffery Hicks","date":"November 9, 2020","format":false,"excerpt":"Lately, I've been spending time learning more about ssh. Sadly, I've rarely had a need to learn and use ssh. But of course, with PowerShell 7 and ssh-based remoting, it is time to up my game. I've started deploying the ssh server component to my Windows test servers (I'll write\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/get-knownhost-3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/get-knownhost-3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/get-knownhost-3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/get-knownhost-3.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7978","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7978"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7978\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}