Sep122010

Managing Virtual Switches and Networks Across Hyper-V Hosts Using Scripts

&#8220;Managing virtual switches should be done from a central point and the configuration should be automatically distributed to the host operating system in such a way as to eliminate the need for a separate configuration switches for each of the hosts.” The requirement to “manage” is pretty generic, that could mean anything. Minimally we’d assume it means create/update/delete virtual switches. System Center Virtual Machine Manager 2008 R2 GUI supports these operations but only on a host by host basis. So per host you can create, update, and delete virtual switches. Since this’s VMM, anything you can do in the GUI you can do via PowerShell and extend. Scripts can be stored in the VMM library and executed from there.

Now when these run, you get presented with PowerShell shell that you can interact with if needed or just have script run without input. You can prompt for user input or get fancy with a menu system. There’re multiple cmdlets that let you do things with virtual networks and switches like New-VirtualNetwork, Set-VirtualNetwork, Get-VirtualNetwork, Remove-VirtualNetwork. From VMM PowerShell console, you can do a get-help on these or see the reference document linked below.

Deepak Gupta is a IT & Web Consultant. He is the founder and CEO of diTii.com & DIT Technologies, where he's engaged in providing Technology Consultancy, Design and Development of Desktop, Web and Mobile applications using various tools and softwares. Sign-up for the Email for daily updates. Google+ Profile.