Skip to content

Instantly share code, notes, and snippets.

@Inndy
Created November 22, 2023 08:58
Show Gist options
  • Save Inndy/7d036eb4413a36d9727bd724a17b26f1 to your computer and use it in GitHub Desktop.
Save Inndy/7d036eb4413a36d9727bd724a17b26f1 to your computer and use it in GitHub Desktop.
Add-WindowsCapability -Online -Name (Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server~~~*').Name
Start-Service sshd
Set-Service sshd -StartupType Automatic
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
ssh w11 powershell 'chcp 65001; Add-Content -Force -Path $env:ProgramData\ssh\administrators_authorized_keys -Value \"ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\";icacls.exe \"$env:ProgramData\ssh\administrators_authorized_keys\" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment