Migrate Logical Networks from VMM to VMM with PowerShell – The Export

Fast publish!

Had to migrate logical networks from an existing VMM 2012 instance into a new shiny VMM 2012 R2 deployment.

This is the export from the existing VMM. The import script will follow shortly:

 
Import-Module virtualmachinemanager 
# all Logical network definitions 
$LogicalNetsdef = Get-SCLogicalNetworkDefinition

Foreach ($def in $LogicalNetsdef){ 
    foreach ($SubnetVlan in $def.SubnetVLans){ 
        $data=[ordered]@{ 
                    LogicalNetworkName = $def.LogicalNetwork.Name 
                    Name=$def.Name 
                    Subnet=$SubnetVlan.Subnet 
                    VlanID=$SubnetVlan.VLanID 
                } 
         $Obj=New-Object -TypeName PSObject -Property $data 
         Write-Output $Obj  
    } 
}

Enjoy!
Dan