Change OpenSSH Server default shell on Windows Server 2019

If you are using OpenSSH Server on Windows Server 2019, the default shell is cmd.exe.

If you want to set the default shell to PowerShell or even PowerShell Core, you can run the following PowerShell command (it will create a registry key) then restart the OpenSSH server service :

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

If you want to use PowerShell Core, change the path of the value variable but note that currently a path with space in directory name seems to be unsupported.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.