How To Migrate Logical Networks from VMM to VMM with PowerShell #VMM #SCVMM #HyperV #PowerShell

3 min read


VMM permits us to create logical grouping for all the networks which are involved in the Datacenter configuration. Once you create the logical grouping, VMM is able to manage the tasks of keeping the respective networks up-to-date and always in sync.

To implement Software Defined Networks in VMM, first you need to prepare the following building blocks:

  • Logical Networks
    • Network Sites:  VLAN ID | Network Subnets
    • IP Pools: IP Address Range | VIPS | Gateway | DNS
  • VM Networks
  • Port Profiles
  • Logical Switches

Unfortunately, the networking side in VMM was always pain to deal with.


After working with an implementation of new VMM 2016, I have been trying to read and document all the networks that were created with the old VMM server.

My old VMM server Logical Networks look like this:

I still want to get all the network information that I had in the old VMM server to be able to create new virtual networks with the same network information on the second VMM server.

Here is a simple PowerShell script that helped me to migrate all Logical Networks, Network Sites, IP Pools and VM Networks from one VMM server to another VMM server:

Migrate VMM Logical Networks, IP Pools, VM Networks from VMM to VMM.

Migrate VMM Logical Networks, IP Pools, and VM Networks from one VMM server to another VMM server.
File Name : Migrate-VMMLogicalNetworks.ps1
Author    : Charbel Nemnom
Version   : 2.0
Requires  : PowerShell Version 4.0 or above
OS        : Windows Server 2012 R2, Windows Server 2016
VMM       : SCVMM 2012 R2, SCVMM 2016 

To provide feedback or for further assistance please visit:

The name of the First VMM Server
The name of the Second VMM Server

.\Migrate-VMMLogicalNetworks -VMMServerToRead <VMMServer01> -VMMServerToCreate <VMMServer02>
This example will migrate all Logial Networks, IP Pools and VM Networks
from one VMM server to another VMM server.


param (
    [Parameter(Mandatory, Position = 0, HelpMessage = 'First VMM Server Name')]
    [Alias('VMM Server 01')]

        [Parameter(Mandatory, Position = 1, HelpMessage = 'Second VMM Server Name')]
    [Alias('VMM Server 02')]

Try {
Write-Verbose "Read First VMM Server: $($VMMServerToRead)"
$VMMToRead   = Get-SCVMMServer -ComputerName $VMMServerToRead
} Catch { 
  Write-Warning -Message "Unable to connect to $($VMMServerToRead)"

Try {
Write-Verbose "Read Second VMM Server: $($VMMServerToCreate)"
$VMMToCreate = Get-SCVMMServer -ComputerName $VMMServerToCreate
} Catch {
  Write-Warning -Message "Unable to connect to $($VMMServerToCreate)"

Write-Verbose "Read All Logical Networks from $($VMMServerToRead)"
$ReadLogicalNetworks = Get-SCLogicalNetwork -VMMServer $VMMToRead

# //Read the LN and create accordingly
ForEach ($ReadLogicalNetwork in $ReadLogicalNetworks)
     Write-Verbose "Create Logical Network: $($ReadLogicalNetwork.Name) on $($VMMServerToCreate)" 
     $LNToCreate = New-SCLogicalNetwork $ReadLogicalNetwork -VMMServer $VMMToCreate   
     # //Read the LND and create accordingly
     $LNDs = Get-SCLogicalNetworkDefinition -LogicalNetwork $ReadLogicalNetwork -VMMServer $VMMToRead
     ForEach ($LND in $LNDs) {
     Write-Verbose "Create Network Site: $($LND.LogicalNetwork.Name) on $($VMMServerToCreate)" 
     $LNDToCreate = New-SCLogicalNetworkDefinition -VMMServer $VMMToCreate -LogicalNetwork $LND.LogicalNetwork.Name -SubnetVLan $LND.SubnetVLans -Name $LND.Name -VMHostGroup $LND.HostGroups

         # //Read IP pools on this LN and create accordingly
        $IPPools = Get-SCStaticIPAddressPool -VMMServer $VMMToRead -LogicalNetworkDefinition $LND
        ForEach ($IPPool in $IPPools) {
        Write-Verbose "Create IP Pool: $($IPPool.Name) on $($VMMServerToCreate)" 
        New-SCStaticIPAddressPool -VMMServer $VMMToCreate -LogicalNetworkDefinition $LNDToCreate -Name $IPPool.Name -Description $IPPool.Description -Subnet $IPPool.Subnet -Vlan $IPPool.VLanID -IPAddressRangeStart $IPPool.IPAddressRangeStart -IPAddressRangeEnd $IPPool.IPAddressRangeEnd -VIPAddressSet $IPPool.VIPAddressSet -DNSServer $IPPool.DNSServers -DNSSuffix $IPPool.DNSSuffix -NetworkRoute $IPPool.NetworkRoute -IPAddressReservedSet $IPPool.IPAddressReservedSet -WINSServer $IPPool.WINSServers -EnableNetBIOS $IPPool.EnableNetBIOS | Out-Null          
     # //Read VM Network on this LN and create accordingly  
     $VMNetwork = Get-SCVMNetwork -VMMServer $VMMToRead -LogicalNetwork $ReadLogicalNetwork
     Write-Verbose "Create VM Network: $($VMNetwork.Name) on $($VMMServerToCreate)" 
     New-SCVMNetwork -VMMServer $VMMToCreate -Name $VMNetwork.Name -LogicalNetwork $LNToCreate -IsolationType $VMNetwork.IsolationType -Description $VMNetwork.Description | Out-Null                  


You can also use this script to merge two different VMM servers to make them use the same configuration.

Here is the output after you run the script.

You can verify that all networks are created successfully on the second VMM server:

Hopefully this helps anyone else coming across this scenario.

[email protected]

About Charbel Nemnom 559 Articles
Charbel Nemnom is a Cloud Architect, ICT Security Expert, Microsoft Most Valuable Professional (MVP), and Microsoft Certified Trainer (MCT), totally fan of the latest's IT platform solutions, accomplished hands-on technical professional with over 17 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize the performance of mission-critical enterprise systems. Excellent communicator is adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design, business continuity, and cloud security.


  1. Hi Charbel,

    How do we move the IP Pools from old VMM to new VMM. I am worried about IP conflict. Let me give you a scenario.

    We have defined following pool range However, I am manually assigning the following IP to a guest server. Does VMM will ignore this ip from the pool? or it will conflict. I don’t want put this IP in VMM pool exclusion. How does it work?

    Thanks in advance.

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