none
Hyper-V virtual switch(es) export then import RRS feed

  • Question

  • Hi,

    We're doing some Windows Server 2012R2 Hyper-V migration to Windows Server 2016 Hyper-V. I would like to check if there's a way (PowerShell cmdlet/script or something else) that can export Hyper-V cluster virtual switch(es) into a file that can also be imported to a newly built Hyper-V cluster? Better yet, if there's a way to export the current cluster config and import to the newly built cluster?

    Thank you

    Monday, December 2, 2019 1:33 PM

Answers

All replies

  • Hi,

    Unfortunately this isn't possible, unless you're using System Center Virtual Machine Manager (SCVMM) which makes this easy and gives you a lot more possibilities when managing your Hyper-V environment(s).

    Only virtual machines can be exported, the switches and other virtual devices are too tightly bound to hardware to be exported.

    Make sure that you use the same names on your virtual switches on your new hosts, then you should be pretty fine.

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    Monday, December 2, 2019 1:45 PM
  • I agree with Leo, there is no export/import for switches.

    However, if you start using scripts to create your clusters, then you should be able to use the same script over and over.  I did this all the time when creating clusters.  I would name my NICs/networks the same at the host level and then have scripts to set up the virtual switches based on the names of the NICs/networks.

    I haven't tried it, but you might be able to write a PowerShell script to read your current switch configuration and capture the name of the switch and its associated NIC/network on the host then output that to a text file.  Then you could write another script to create the new environment from the text file.

    Of course, if this is a one time project, it will be much quicker to simply do it manually.  But for the future, I would recommend creating scripts for creation.  Not only will it help in migrating, but it will help in disaster recovery, too.


    tim

    Monday, December 2, 2019 2:09 PM
  • Thank you Time and Leon for the answers.

    I do have this line in my build script:

    New-VMSwitch -Name Internal -SwitchType Internal; New-VMSwitch -Name Private -SwitchType Private; New-VMSwitch -Name vSwitch -NetAdapterName 'Ethernet0' -AllowManagementOS $true

    that I execute for each node.

    Will look into your suggestions, Tim.

    Tuesday, December 3, 2019 12:45 PM
  • Switch type of Internal means that the switch is available only on that node.  If you have two VMs that end up on different nodes of the cluster, and  they have to communicated via the network, there will not find each other.

    tim

    Tuesday, December 3, 2019 2:09 PM