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