June 12, 2015

SCVMM 2012 R2 - Remove logical network definition

Tried to remove logical network and got 25100 error. All dependencies were removed except logical network definition.

$LogicalNetworkName = Get-SCLogicalNetwork "Logical_Network_Name"
$LogicalNetworkName | Remove-SCLogicalNetwork

Error (25100)
VMM is unable to delete the logical network (Logical_Network_Name) because other objects, such as network sites, virtual network adapters, host network adapters, host network adapter profiles, load balancers, load balancer templates or VM networks still depend on it.

Tried to remove logical network definition but got error 25222

$LogicalNetworkName = Get-SCLogicalNetwork "Logical_Network_Name"
$LogicalNetworkDefinition = Get-SCLogicalNetworkDefinition | ? {$_.LogicalNetwork -eq $LogicalNetworkName}
$LogicalNetworkDefinition | Remove-SCLogicalNetworkDefinition

Error (25222)
The external network entity (Logical_Network_Definition_Name) imported from a virtual switch extension manager cannot be deleted.

Remove button in network site of logical network configuration is not active so I am not able even change vlan or subnet. Also noticed NetworkEntityAccessType - VmmManagedMarkedForDeletion output from Get-SCLogicalNetworkDefinition. 
The fix is to change SubnetVLans property of network definition (by setting new subnet/vlan to it) so NetworkEntityAccessType property will be set to VmmManaged and as result remove button becomes available allowing me to remove logical network.

$LogicalNetworkName = Get-SCLogicalNetwork "Logical_Network_Name"
$LogicalNetworkDefinition = Get-SCLogicalNetworkDefinition | ? {$_.LogicalNetwork -eq $LogicalNetworkName}
# As example I took 192.168.0.0/24 subnet with 192 vlan
$NewSubnetVlan = New-SCSubnetVLan -Subnet "192.168.0.0/24" -VLanID "192"
Set-SCLogicalNetworkDefinition -LogicalNetworkDefinition $LogicalNetworkDefinition -SubnetVLan $NewSubnetVlan

No comments:

Post a Comment