Windows 2022
Sponsored Link

OpenSSH : Change default Shell2021/12/01

 
When login to OpenSSH Server from Clients, Command prompt runs as default Shell,
however, if you'd like to change it to PowerShell, Configure like follows.
[1] Run PowerShell on OpenSSH Server and Change setting.
# confirm the PATH of powershell command
PS C:\Users\Administrator> Get-Command powershell | Format-Table -AutoSize -Wrap 

CommandType Name           Version      Source
----------- ----           -------      ------
Application powershell.exe 10.0.20348.1 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe


# set DefaultShell=PowerShell in registry entry of OpenSSH
# for the PATH of PowerShell, specify the result of above
PS C:\Users\Administrator> New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force 

DefaultShell : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE
PSChildName  : OpenSSH
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry
Matched Content