Fixing switch port leaks in VMM

hi everyone, it has become apparent that VMM 2008 R2 has switch port leaks when performing checkpointing operations through VMM (either through the PowerShell interface, through Visual Studio Lab Manager, through the self-service portal, or through the VMM Administrator Console)

This is a known issue that we will potentially address in an upcoming QFE. For now, there is a workaround that is detailed in this blog post. Alex from our team wrote the PowerShell script that resolves this issue.

How to tell if you have switch port leaks:

  1. You are managing Hyper-V using VMM
  2. Calling the following cmdlet from PowerShell take more than 3 minutes to return: get-vmhost "<host computer name FQDN>" | refresh-vmhost???
  3. executing the following queries locally on the Hyper-V host from an elevated command prompt return more than a couple of hundred different objects. Running the same query command from wbemtest.exe connecting to root\virtualization as "select * from Msvm_hostedaccesspoint" for example will give you an instant count.
    1. ??winrm enum wmi/root/virtualization/Msvm_hostedaccesspoint
    2. ??winrm enum wmi/root/virtualization/Msvm_resourceallocationsettingdata
    3. ??winrm enum wmi/root/virtualization/Msvm_networkelementsettingdata
    4. winrm enum wmi/root/virtualization/Msvm_bindsto?

How to fix the switch port leaks:

  1. Run the attached powershell script locally on the Hyper-V host from an elevated powershell window. This command will return back data on the unused networking elements in Hyper-V that were potentially leaked by VMM
    1. DeleteUnusedHyper-VNetworkingComponents.ps1 <hostname FQDN> no
  2. If you are satisfied with the objects that will potentially be deleted, run the same cmdlet with the "yes" switch.
    1. DeleteUnusedHyper-VNetworkingComponents.ps1 <hostname FQDN> yes
  3. Run refresh-vmhost again in VMM a couple of times to observe the increase in speed
  4. Create a scheduled task to execute this script against your Hyper-V hosts every couple of weeks.