Importing Virtual Machine With Missing RemoteFX Adapter: Unhandled exception has occurred in your application #HyperV #RDS #VDI

Introduction

I am currently working on several Microsoft RDS/VDI projects, and what is better than Hyper-V, RDS and Unidesk integration. Awesome stuff!

While importing a virtual machine in Hyper-V Manager, I received the following Unhandled exception error:

[Unhandled exception has occurred in your application. If you click Continue, the application will ignore and attempt to continue. If you click Quit, the application will close immediately.]

HyperV-RemoteFXAdapter-Import-VM02

Well Hyper-V Manager console will crash and close if you click either option.

As you can see in the error message thrown in the UI is not clear enough, if we dig deeper and expand the details, we can see the following message:

At first I did not realize from where this error came from.

If you noticed at the beginning of this message, we can see the following:

[Microsoft.Virtualization.Client.Wizards.VMFixup.FixRemoteFxPage.LoadDataComplete].

If you recall, every time you have ever tried to import or register a virtual machine in Hyper-V Manager, and the virtual machine was not compatible with your current computer (i.e. memory, processor, virtual switch, etc…), you will receive a warning message to take corrective action before you continue. This is a GUI experience that allows you to make changes to the incoming virtual machine in order to make it work on the physical computer. Microsoft internally refers to it as “the fix-up wizard”, as it allows you to fix a virtual machine and make it compatible with your computer.

However, this is not the case when you import or register a virtual machine with missing RemoteFX Adapter, the GUI do not give you the option to fix it, the import wizard GUI will crash. Is it a bug in the UI? Probably Yes!

If we try to import the same VM using PowerShell, you will get a different error message, but you are guided to use Compare-VM to repair the virtual machine.

HyperV-RemoteFXAdapter-Import-VM03

Cause

The root cause of this error is that Windows Server 2012 R2 Remote Desktop Virtualization Host did not have the physical GPU selected under Hyper-V Settings:

HyperV-RemoteFXAdapter-Import-VM00

Resolution

There are two options actually to fix this error, the first one is very obvious, selected the right GPU under Hyper-V Settings if your host capable and you are good to go, and the second one is using PowerShell to remove the RemoteFx Adapter and import the VM into a Hyper-V host where you don’t have a GPU installed. I will show you the latter option which you will need if you want to start this VM without RemoteFx Adapter.

So how do you make this VM to work? Well the answer is in the error message as shown above: use Compare-VM. “Compare-VM” is the PowerShell equivalent of “the fix-up wizard” in the UI.

In this case you need to use Compare-VM and provide it with exactly the same parameters that I was using for Import-VM. This returns a virtual machine compatibility report – which I will store in the variable called $vmReport

HyperV-RemoteFXAdapter-Import-VM05

As you can see, the virtual machine compatibility report has a property called “Incompatibilities”.  This property is a collection of everything that is wrong with the virtual machine. Here I have a RemoteFX Adapter that is failed to find any RemoteFX capable host.

If we go deeper and look at the “RemoteFxAdapter” VM property, we can see all the settings for this adapter.

HyperV-RemoteFXAdapter-Import-VM12

There is only one way that you can fix up this particular problem. This way is to remove the virtual machine object (RemoteFxAdapter) that is attached to the virtual machine compatibility report itself. Below I show you how to do it:

HyperV-RemoteFXAdapter-Import-VM14

As you can see when removing the adapter from the compatibility report, we received another error as well [cannot add more than one instance of device ‘Microsoft:Hyper-V:Synthetic Display Controller’.] However, the RemoteFxAdapter was removed successfully:

HyperV-RemoteFXAdapter-Import-VM15

Once you have removed the RemoteFxAdapter from the incompatibilities you can successfully import the virtual machine by using Import-VM and passing it the corrected compatibility report.

HyperV-RemoteFXAdapter-Import-VM16

Here is the settings for the same VM on a host with GPU and RemoteFxAdapter attached to it.HyperV-RemoteFXAdapter-Import-VM11

The same VM imported and running without RemoteFxAdapter on a Hyper-V host without GPU.

HyperV-RemoteFXAdapter-Import-VM10

Hope this helps!

Enjoy your weekend…

Cheers,
-Charbel

About Charbel Nemnom 325 Articles

Charbel Nemnom is a Microsoft Cloud Consultant and Technical Evangelist, totally fan of the latest’s IT platform solutions, accomplished hands-on technical professional with over 15 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize performance of mission-critical enterprise systems. Excellent communicator adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design and virtualization.

Be the first to comment

Leave a Reply