Skip to content

Instantly share code, notes, and snippets.

@mwallner
Created June 13, 2022 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwallner/7c01a96c9c03eb00cfe95d6a5c1c8257 to your computer and use it in GitHub Desktop.
Save mwallner/7c01a96c9c03eb00cfe95d6a5c1c8257 to your computer and use it in GitHub Desktop.
WIndows VM Base pwsh and SSH Remoting
choco install pwsh -y
choco install ripgrep -y
choco install vscode -y
Get-WindowsCapability -Online | Where-Object {$_.Name -like 'OpenSSH*'} | Add-WindowsCapability -Online
Start-Service sshd
Set-Service sshd -StartupType Automatic
Stop-Service sshd
$sshd_config = "${env:ProgramData}\ssh\sshd_config"
$sshd_bk = "$sshd_config.bk"
if (-Not (Test-Path $sshd_bk)) {
Move-Item $sshd_config "${env:ProgramData}\ssh\sshd_config.bk"
}
@"
Port 22
AddressFamily any
ListenAddress 0.0.0.0
PasswordAuthentication yes
PermitEmptyPasswords no
Subsystem powershell c:/progra~1/powershell/7/pwsh.exe -sshs -NoLogo
"@ | Out-File $sshd_config -Encoding UTF8
Start-Service sshd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment