Unable To Delete Logical Switch From SCVMM 2012 R2

This post is about a situation where I was not able to remove a logical switch from System Center Virtual Machine Manager 2012 R2 (with Update Rollup 1). This scenario might affect other versions. And the fix might not work for everyone.

I was removing a bunch of logical network stuff from VMM, just mucking around with different types of builds to find one that suited my needs in the lab. I came to delete the virtual switch (logical switch) from Fabric in the SCVMM console but it failed to go. The reason given was that there was a remaining dependency. I checked the dependencies but none were listed.

Very strange!

I tried everything I could think of. Then I gave my MVP friend Damian Flynn a shout to see if he’d seen it. He had (if Damian hasn’t seen it, then it doesn’t exist in VMM), but wasn’t able to remember exactly what the fix was. I suspected I’d be using PowerShell. Damian confirmed it. So we went “wandering” in SCVMM. I found a remaining VM Network. There is no inter-dependency with it and the logical switch, but I decided to delete it. And it wouldn’t delete because a physical computer network adapter was depending on it.

That was strange – I had no hosts or physical computer hardware profiles left ,,, apparently. Time for PowerShell. Finding the verb-noun combination was easy. Damian filled in the –all for me. The following cmdlet corrected me.

Get-SCPhysicalComputerNetworkAdapterProfile -all

Interesting.

I tried but it failed.

Get-SCPhysicalComputerNetworkAdapterProfile -all |Remove-SCPhysicalComputerNetworkAdapterProfile

Apparently a virtual network adapter depended on these physical NICs. Ah… now I knew what was wrong. More on that later.

The next cmdlet confirmed my theory:

Get-SCVirtualNetworkAdapter –all

I removed that virtual network adapter with:

Get-SCVirtualNetworkAdapter -all | Remove-SCVirtualNetworkAdapter

Now I was able to run the following:

Get-SCPhysicalComputerNetworkAdapterProfile -all |Remove-SCPhysicalComputerNetworkAdapterProfile

Then I was able to remove both the virtual network and the logical switch.

So what happened? My previously deleted physical computer hardware profile featured two physical NICs (with CDN defined – don’t know if that’s important for this situation). Those two NICs were teamed using a logical switch and uplink port profile, and a virtual management adapter was connected to the logical switch. That’s what my queries revealed: a virtual network adapter (the virtual management NIC) and physical network adapters. Both the VM Network and the logical switch were dependent on these resources.

It appears that the process to delete the physical computer hardware profile left behind the physical NICs and the virtual management adapter, and the GUI didn’t have a way to present those stragglers.

Thanks to Damian for his help … it proved to be a fine opportunity to run through my design with him. Doing Hyper-V networking via SCVMM is quite different to the much more flexible native WS2012 R2 PowerShell option.

2 thoughts on “Unable To Delete Logical Switch From SCVMM 2012 R2”

  1. I have had this issue in a test environment (2012 R2 U1). It seems to be more of a problem when the hardware profile contains a virtual nic for management, as there is a physical nic is bound to the virtual nic. It seems that VMM creates a copy of the network adapter profiles when you begin making a change, If there is an error it doesn’t roll them back out again.

  2. Found a similar issue where this occurs when moving to a new logical or standard network switch on all VMs, then trying to remove the original logical switch following the migration.
    If any VMs have existing checkpoints the checkpoints will still be on the old logical switch and wont be listed under dependencies. Only option is to remove the checkpoints.

    Use the following powershell command to easily identify the checkpoints responsible:

    get-scvirtualnetworkadapter -all | select name,virtualnetwork | format-table

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.