Powershell font size

I have recently installed from scratch a vanilla Windows 8.1 Enterprise ISO (GA) on a Surface Pro but when I launched Powershell by typing ‘Powershell’ in the Start Menu, I got this 😦

Ugly isn’t it. The fonts size is just 4×6 which is unreadable compared to the old command prompt that you can see in the background.

I’ve made the whole installation more than once and tried different local accounts to make sure the above ugly interface I got was persistent across users and installations of Windows. In other words I’m able reproduce the issue to start figuring out what’s going on.

Then I started looking at what Powershell itself can do to fix my problem. I thought I would just edit one of the Powershell profiles and set the font size there.
I explored the $host variable, $host.RAW.UI as well as the [system.console] .Net class but got disappointed. There’s no easy way to change the font size, like I’d change the BufferSize, the WindowTitle or the BackgroundColor.

As plan A failed, I switched to plan B which is basically ‘when in doubt, run process monitor’.

Here’s what I discovered, I’ll try to keep it short.

When I press [Win+Q] and type “Powershell”, the search proposes a link to the shortcut file that is located in:
“C:\ProgramData\Microsoft\Windows\Start Menu\Programs\System Tools\Windows Powershell.lnk”

Notice that the result of the search is named “Windows Powershell”.

If I execute it, it reads this shortcut file (.lnk) and launches its target.
To be more accurrate, it reads it ExtraData block of the shortcut file which holds the ‘ConsoleDataBlock‘ that inventories all the display settings such as the font size.

If I right-click the lnk file, it appears to be somehow “corrupted”:

Now, if I rename the shortcut file’s extension, the search being performed by [Win]+Q doesn’t find it and reaches powershell.exe located in C:\Windows\system32\WindowsPowerShell\v1.0\, which itself is a hardlink to a powershell.exe file in the WinSXS folder.

Now notice that the result of the search is no longer named “Windows Powershell” but just “Powershell”:

Then Process Monitor aka ProcMon also reveals that it reads first the FontSize value under the HKEY_CURRENT_USER\Console key and then complains that it doesn’t find a font size value under the HKCU\Console\%systemroot%_System32_WindowsPowershell_v1.0_powershell.exe key.

There are 4 solutions:

  • Open a support call to fix my current issue and/or fill-in a suggestion on connect.microsoft.com
  • Use the SetConsoleFont Module marked as compatible with XP on the technet gallery that has these caveats
  • Deploy a shortcut file that has the correct font size
  • Delete the shortcut file and write the FontSize value in the registry

3 thoughts on “Powershell font size

  1. I’ve noticed today that it works correctly in a virtual machine (a V2 type on Hyper-V 2012 R2) despite the presence of the corrupted shortcut. I hadn’t enough time to investigate what’s different…

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