So I’ve been playing with server core for few days now. I’m really starting to get the hang of the interface. I did however, goof something up. I accidentally created a virtual switch on the wrong NIC. I still think the way MS assigns the NICs is silly. the NICs are labled 1-4 on the box, but MS just seems to randomly pick adaper numbers. Probably not random, I just don’t know the answer. thats for another blog post, I suppose.

Regardless, I found myself needing to remove that virtual switch. Turns out someone smart figured out how to do that. Roger Johnson found a way to make it happen. In a nutshell, he found a way to create an object reference to the WMI class “MSVM_VirtualSwitchManagementService”. Very cool! anyway, here’s the steps. basic even for those of us who need a complete walkthrough:

1. download the hyper-v module. you’ll need that for the commands to function. You can download from Codeplex

2. right click on the .zip file and unblock it. then move it to your server. I use a network mapped drive that I can access from my server. Copy the file to where the rest of your modules are:

3. Check to make sure powershell can find it. open powershell from the command prompt by simply typing “powershell”. Then enter the command

Get-Module -list

4. Import the module.

import-module HyperV

Now the fun stuff. the POWERSHELL!

Set your execution policy to unrestricted for this session.

Set-ExecutionPolicy Unrestricted

Create a variable and set it equal to that WMI class
$HVSwitchObj = Get-WMIObject –class “MSVM_VirtualSwitchManagementService” –namespace “root\virtualization” –computer “.”

Select the virtual switch to be deleted. Again we create a variable for that

 $HVSwitch = Choose-VMSwitch

Then delete that offending switch!


GONE! fun. right? any props should go to Roger Johnson. he put the hard part together. I just added some of the basic stuff at the begining.