Home > PowerShell Scripting, Windows Server > Changing the default shell of Windows Server 8 Core

Changing the default shell of Windows Server 8 Core

I have to admit, I’m a bit torn with Windows 8 in general. I’m absolutely in love with Windows Server 8’s new Powershell functions and management console, but despise the lack of a start menu. Luckily Powershell has gotten so powerful in Server 8, I hope to not spend much time in the Gui.

Back on topic: By default when you install Windows Server 8 Core and log into the console, you get presented with a CMD prompt… Weird eh?

Now most administrators will simply type powershell and perform their tasks, but I personally feel this is the wrong way around. Powershell should launch first, and if cmd is really needed you could call it inside of powershell!

Being the pedantic individual that I am, I set about changing Server Core to auto-load powershell on login. This was quite an easy task and I’ve documented it below for other users to follow if they wish:

The shell in Windows Server 8 is configured under the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AlternateShells\AvailableShells

Under this key, on Server 8 Core, you will see the following entry:

And that’s where our CMD is coming from! This is another one of these blasted TrustedInstaller Keys. So if you want to change it, you’ll need to take owership of the key, then assign full control to your user account.

So the first thing I did was create a value lower than 30000 and assign it to powershell, but this didnt work.

Unusually here the weighting system is highest wins, rather than lowest which is a little counter intuitive, but I digress.

I added a new key 90000 (i’ll explain this later) and entered the path to powershell as below:

Now Once I restarted, Powershell is the automatic shell of choice:

Bonus 1: Why 90000?

Well if you look at a Server 8 Gui server, you’ll notice that Explorer.exe wins the selection by being 60000:

So I added another 30000 and bob’s your uncle.

If you asked yourself, “hmmm, could i also do this on windows server 8 where the gui is installed?the answer is yes.

And if you asked yourself  “hmmm, could I also do this on Windows 8?the answer is no.

And if you also asked yourself “hmmm, could i assign these in a users key instead of local machine?the answer is no.

About these ads
    • July 8, 2012 at 6:40 pm

      Hi Thomas, you’ll notice my post was released a number of months ago before the release candidate. As a Citrix guy I’m well aware of the shell key and when I tested that key with the beta candidate, it didn’t work.

      my post also goes into the logic behind the shell decision via the registry, so I’ll be leaving it intact rather than just brute forcing it with the shell key.

      • February 9, 2013 at 11:35 pm

        Strange that the “shell” value was ignored in the community preview. Must have been a bug…

      • February 9, 2013 at 11:42 pm

        Hey Helge, thanks for dropping by!

        That article was a while ago now, but I was interested in how it was being done, rather than brute forcing it with the shell key… It actually didnt occur to me to try it.

        Consequently I haven’t tested the shell key, does it work?

        A

  1. July 8, 2012 at 3:51 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 2,303 other followers

%d bloggers like this: