Free Tool: Migrate Hyper-V Management OS Virtual Adapters To Another Switch Free Tool: Migrate Hyper-V Management OS Virtual Adapters To Another Switch

14 Aug by Eric Siron     3     Free Hyper-V Scripts & Tools

Moving a virtual machine’s virtual adapter from one virtual switch to another is easy. It’s a drop-down box on the VM’s properties or a quick flip with Disconnect-VMNetworkAdapter and Connect-VMNetworkAdapter. None of this works for virtual adapters in the management operating system, though. Luckily for you, I’ve come up with a script that will do it. I even went and gave it a GUI.

How To Get It

Download right from this site: Migrate-VirtualAdapters.

How To Use It

  1. Make sure that you unblock the file. Right-click the file in Windows Explorer and go to Properties. Click the “Unblock” button. You can also use the Unblock-File cmdlet.
  2. The contents of the ZIP file, at least the .PS1 and .PSD1 file, need to find their way onto the Hyper-V host that contains the VMs to be changed.
  3. The execution policy on that host needs to be RemoteSigned or Unrestricted ( Set-ExecutionPolicy RemoteSigned ).
  4. The host the script is to run on must have at least two virtual switches or it won’t even open.
  5. Execute Migrate-VirtualAdapters.ps1 in a PowerShell session on that host. The PowerShell session must have elevated privileges.

What It Does

This script has a GUI and I hope it explains itself fairly well as it goes along.

The first screen is just a welcome box.

Adapter Migration Intro

Adapter Migration Intro

On the second screen, select the source and destination switch. Optionally, you can delete the source switch. The script won’t let you proceed if you pick the same switch for both.

Adapter Migration Switch

Adapter Migration Switch

On the third screen, check the adapters you want to move. If you are deleting the source switch, all others will be lost. Otherwise, they’ll be ignored.

Adapter Migration Adapters

Adapter Migration Adapters

On the fourth screen, you get a plain-language summary of what’s going to happen and a display of the PowerShell scripts that are going to run.

Adapter Migration Summary

Adapter Migration Summary

On the last page, it will just show success. Because, what could possibly go wrong? If you are unlucky enough to encounter any errors, they will be displayed here. If there are any problems during the move of the adapter, those will halt the entire process. For anything after, mainly recreating settings, the script will continue to run as much as it can and report whatever issues it runs into.

Please be aware that while the script will transfer any access-mode VLAN settings, it will not move any trunk settings. If this turns out to be a major sticking point I may revisit the subject in a later revision. Leave comments if you’re interested.

 

Backing up Hyper-V

If you’d like to make backing up your Hyper-V VMs easy, fast and reliable, check out Altaro Hyper-V Backup v4. It’s free for up to 2 VMs and supports Hyper-V Server 2012 R2! Need more? Download a 30-day trial of our Unlimited Edition here: http://www.altaro.com/hyper-v-backup/.

Receive all our free Hyper-V guides, checklists and ebooks first via email!

(Don’t worry, we hate spam too!)

Eric Siron

I have worked in the information technology field since 1998. I have designed, deployed, and maintained server, desktop, network, and storage systems. I provided all levels of support for businesses ranging from single-user through enterprises with thousands of seats. Along the way, I have achieved a number of Microsoft certifications and was a Microsoft Certified Trainer for four years. In 2010, I deployed a Hyper-V Server 2008 R2 system and began writing about my experiences. Since then, I have been writing regular blogs and contributing what I can to the Hyper-V community through forum participation and free scripts.

3 Responses to “Free Tool: Migrate Hyper-V Management OS Virtual Adapters To Another Switch”

  1. Stephen Barash

    Eric, sorry but I don’t really get what this does. You say its easy to move virtual adapters, yet you can’t do this in the management operating system.

    But, if I use Hyper-V Manger’s Virtual Switch Manger to move virtual adapters, aren’t I already doing this via the management operating system?

    Thanks,
    Stephen

    • Eric Siron
      Eric Siron

      The built-in tools can only relocate virtual adapters connected to virtual machines. This script can only relocate virtual adapters connected to the management operating system.

  2. James Stephan

    I wrote something very similar for the new all GUI powershell Hyperv manager PSHVM30 and I even intergrated it with corefig 1.1. check it out pshvm.codeplex.com

Leave a comment