Automatically Use PowerShell on Server Core

windows-server-2012windows-server-core

When I locally log in to a Server 2012 Core installation, every time I have to type powershell to get to a PowerShell command line instead of plain ol' cmd.

Assuming that I will never remove the PowerShell Windows Feature, how can I configure the server to just get me straight into a PowerShell prompt instead of cmd?

Best Answer

Simply add your powershell command line as a new value to the "AvailableShells" regkey to have it as a machine-wide setting:

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AlternateShells\AvailableShells" /v "90000" /t REG_SZ /d "%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\Powershell.exe"

Reference: http://andrewmorgan.ie/2012/03/30/changing-the-default-shell-of-windows-server-8-core/

Edit: note that the default registry permissions for the "AvailableShells" key will not allow for the change. You will have to change the permissions beforehand (e.g. manually through "regedit") to allow your account (or the "Administrators" group) to perform this change.