Got myself a new mobile workstation (Lenovo P50), and was looking forward to be able to run my Hyper-V lab on this powerful beast. With a Xeon processor, 64GB ram and m12 Solid State drives I thought testing deployments would become a breeze… But what I found was that this new computer, which has a 4K display would give me quite a few headaches!

Problem is that when using Hyper-V Virtual Machine Connection to connect to the guests, it relies on the Guest OS to handle the display scaling within the OS itself. This results in very small windows for operating systems that does not handle DPI scaling like some Linux distributions and to my great annoyance Windows PE!.

So when connecting to my guests the windows looked like this:

Before

As you might suspect these small windows would cause you to squint quite a lot to see what is going on, an reading logfiles are near impossible…

The Fix

After drawing blank at my fellow deployment gurus I started trawling the internet for a solution, several days later after reading a lot of developer documentation on display scaling I finally found a solution!

Add the following registry key to tell Windows to prefer external manifest files:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\PreferExternalManifest=1 (DWORD value)

Place a manifest file beside the executable that you want Windows to scale properly and that’s it!

After

Now your Hyper-V Virtual Machine Connection scales better, and squinting is a thing of the past.

Manifest file

Add the registry key mentioned above and locate the executable that causing you problems, in this case it is the vmconnect.exe located in the Windows\System32 directory.
Download the program.manifest file attached below and rename it to vmconnect.exe.manifest and place it next to the executable like this:

filelocation

the manifest file is just an xml file that looks like this:

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?> <assembly xmlns=”urn:schemas-microsoft-com:asm.v1″ manifestVersion=”1.0″ xmlns:asmv3=”urn:schemas-microsoft-com:asm.v3″> <dependency> <dependentAssembly> <assemblyIdentity type=”win32″ name=”Microsoft.Windows.Common-Controls” version=”6.0.0.0″ processorArchitecture=”*” publicKeyToken=”6595b64144ccf1df” language=”*”> </assemblyIdentity> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity type=”win32″ name=”Microsoft.VC90.CRT” version=”9.0.21022.8″ processorArchitecture=”amd64″ publicKeyToken=”1fc8b3b9a1e18e3b”> </assemblyIdentity> </dependentAssembly> </dependency> <trustInfo xmlns=”urn:schemas-microsoft-com:asm.v3″> <security> <requestedPrivileges> <requestedExecutionLevel level=”asInvoker” uiAccess=”false”/> </requestedPrivileges> </security> </trustInfo> <asmv3:application> <asmv3:windowsSettings xmlns=”http://schemas.microsoft.com/SMI/2005/WindowsSettings”> <ms_windowsSettings:dpiAware xmlns:ms_windowsSettings=”http://schemas.microsoft.com/SMI/2005/WindowsSettings”>false</ms_windowsSettings:dpiAware> </asmv3:windowsSettings> </asmv3:application> </assembly>

Start your program and that’s it, no reboot needed.

Remote Desktop

After this success, I thought about other uses for this fix, one of the obvious ones were RDP connection to computers that do not handle the scaling, such as Windows Server 2008.

Before adding manifest file to mstsc.exe:

RDP before

After adding a manifest file:

RDP After

So this also works for getting a more usable RDP connection on 4K or 3K monitors.

What I have done is copied the mstsc.exe to mstsc2.exe and copied the mstsc.exe.mui language file in the en-us language folder (make change in the appropriate language folder). I then added a mstsc2.exe.manifest file allowing me to choose whether or not to correct the display scaling depending on the OS I’m connecting to.

You can download the program.manifest file here: [download id=”279″]