Hyper-V Failed to update configuration for port

Posted: March 9, 2013 in HyperV, Solved
Tags: , , , ,

On a Hyper-V server I’m seeing an EventID12 in Hyper-V-VMSwitch appearing at what appears to be random intervals. I haven’t seen a pattern to when they appear, but I’ve started paying more attention

Failed to update configuration for port {GUID} (Friendly Name: {GUID}) on switch SWITCH-SM-{GUID} (Friendly Name: {Name}), status = An attempt has been made to remove a file or directory that cannot be deleted..

I’ve found various registry entries that match the various GUIDs, so I’m thinking I’ve ended up with some redundant duplicates or something. The entry seems to describe my actual main Production virtual switch though, so some more investigation is needed.

SOLUTION

It looks like this is related to some sort of corruption (or permissions?) of the registry entry for the Virtual switch port. I suspect it may have happened after a server crash or unexpected restart, and it seems to apply to only some Virtual Guest Machines.

The fix is pretty simple, the harder part is working out which Virtual Machine(s) is causing the issue.

In my case, I realised that when I started one particular machine I would always get the error so that was my starting point. I was able to reproduce the error by changing that machines virtual network from my “PROD” vSwitch to another one (or “Not Connected”). The error wouldn’t appear when switching back though, only when changing *away* from the PROD switch.

To fix the error:

  1. Make a note from the Event log entry of the switch name (e.g. SWITCH-SM-B419C19F-…) and the port name (e.g. D4C3161D-…)
  2. Determine which Virtual Machine and network adapter is being referenced by the port GUID entry. The best way I have found to do this so far is the following powershell command
    1. get-vm | Get-VMSwitchExtensionPortData| where-object {$_.Data -like "*{GUID}*"} | select vmname
    2. e.g. get-vm | Get-VMSwitchExtensionPortData| where-object {$_.Data -like "*D4C3161D*"} | select vmname
  3. Under “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VMSMP\Parameters\SwitchList” you will see entries for each of the Virtual Switches you have. Expand the key that matches the switch name from the event error. If there is no matching entry, expand each one and look for the “FriendlyName” that matches the event error
  4. Look for a sub-key that matches the Port GUID and expand it
  5. Locate the “Backup” subkey and delete it

You can reproduce the error, or check if it is fixed by doing the following:

  1. In the Virtual Machine Settings, change the properties of the network adapter to “Not Connected”
  2. Check the Event Viewer and a new error entry should be logged
  3. Refresh Regedit and check if the GUID entry for the Port is still present. If it is then check if there is any data or additional sub-keys still present.  This is the cause of the event error entry when the system is unable to delete the old port entry.
  4. If no error entries are logged then the problem has been resolved
  5. Change the Virtual Machine Settings and set the network adapter back to the required Virtual Switch

You can even manually create a dummy sub-key under the port GUID to force the error to be logged.

Comments
  1. Thomas says:

    Aweseome, thanks a lot for the tip.

  2. Lloyd says:

    It seems(?) like this error/fix is related to Hyper-V where an in place upgrade from Windows Server 2008 R2 to Server 2012 is done on the Hyper-V host. I read this on another post and this upgrade issue seems to be case for my scenario. Upgrading 2008 R2 -2012 also causes the default Hyper-V PowerShell commands as used above not be installed (had to do “Add-WindowsFeature Hyper-V-PowerShell” from Powershell).

    Scott thanks for the Fix

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