Change default shell for OpenSSH on Windows

If you are using OpenSSH on Windows the default shell used when connecting is cmd.exe. To update Windows to use something different you need to update the registry and restart the OpenSSH service.

Run the following commands, update the Value to the path on the server that points to the PowerShell Core executable. Next time you log in PowerShell Core will be the default shell.

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Users\ServerAdmin\scoop\apps\pwsh\current\pwsh.exe" -PropertyType String -Force
Restart-Service -Name sshd