I’m trying to migrate in VMM 2016 the VM Network, VM Logical Network, and all IP Pools that go with that network. See in the attached code block the first two sections do work OK. It finds and creates the logical network and the VM network from the source VMM server.
When I run the 3rd section to read and create the Logical Network Definitions I get the error:
New-SCLogicalNetworkDefinition : Unable to find the specified host group. The host group name may be incorrect, or the host group may have been moved or deleted. (Error ID: 1750)Verify that the host group name is correct, that the host group exists on the Virtual Machine Manager management server, and that the host group is in the specified host path.
So its something with that -VMHostGroup $LND.HostGroups section. However if I run just the variable $LND.HostGroups it returns:
PS C:\Windows\system32> $LND.HostGroups
PS C:\Windows\system32> $LND.HostGroups
AllowUnencryptedTransfers : True
CreationDate : 6/4/2013 4:34:35 PM
Creator : ME\user
Description :
ID : 17441540-f13f-438f-ac3c-81994f2d440e
InheritNetworkSettings : True
IsFullyCached : True
IsRoot : False
MarkedForDeletion : False
ModificationDate : 7/17/2017 9:23:13 AM
ModifiedBy : ME\user
Name : Group 1 Hosts
ParentHostGroup : All Hosts
Path : All Hosts\Group 1 Hosts
ServerConnection : Microsoft.SystemCenter.VirtualMachineManager.Remoting.ServerConnection
Any suggestions on how to get around this? This Logical network has about 100 IP Pools under it I would like to not have to manually re-enter on the new VMM server I am working on.
# Find logical network being queried from SourceVMMsvr and Create it on DestVMMsvr
$ReadLogicalNetwork = Get-SCLogicalNetwork -VMMServer SourceVMMsvr | Where-Object Name -eq “VM Logical Network 1”
New-SCLogicalNetwork $ReadLogicalNetwork -VMMServer DestVMMsvr
# Read VM Network on SourceVMMsvr and create on DestVMMsvr
$VMNetwork = Get-SCVMNetwork -VMMServer SourceVMMsvr -LogicalNetwork $ReadLogicalNetwork
New-SCVMNetwork -VMMServer DestVMMsvr -Name $VMNetwork.Name -LogicalNetwork $LNToCreate -IsolationType $VMNetwork.IsolationType -Description $VMNetwork.Description | Out-Null
# Read the Logical Network Definitions from SourceVMMsvr and create on DestVMMsvr
$LNDs = Get-SCLogicalNetworkDefinition -LogicalNetwork $ReadLogicalNetwork -VMMServer SourceVMMsvr
ForEach ($LND in $LNDs) {
$LNDToCreate = New-SCLogicalNetworkDefinition -VMMServer DestVMMsvr -LogicalNetwork $LND.LogicalNetwork.Name -SubnetVLan $LND.SubnetVLans -Name $LND.Name -VMHostGroup $LND.HostGroups
# Read IP pools on this Logical Network and create on DestVMMsvr
$IPPools = Get-SCStaticIPAddressPool -VMMServer SourceVMMsvr -LogicalNetworkDefinition $LND
ForEach ($IPPool in $IPPools) {
New-SCStaticIPAddressPool -VMMServer DestVMMsvr -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
}
}