Remove Networks and IP Pools from VMM 2012

Author by Shannon Fritz

If you have configured  Logical Networks with IP Pools in System Center Virtual Machine Manager 2012 SP1, you may at some point find yourself wanting to remove that IP Pool for one reason or another.  For example, perhaps the subnet was previously defined in an unused Logical Network and now when you try to create a new Network you get an error about the Subnet overlapping with with one that already exists. image
Error (13638) Unable to assign the subnet because it overlaps with an existing subnet. Recommended Action Specify a non-overlapping subnet, and then try the operation again.
This error is likely complaining that you have a “Site” defined on another Logical Network that specifies the same Subnet.  You can remove it by opening the Properties of the Logical Network, select the Network Site and Remove it. image If you also have an IP Pool defined you’ll want to Remove that as well. image However, if that pool had been defined with a Subnet which has been around in your environment for a while, VMM might have discovered that some Virtual Machines or Hosts that it is managing already has some IP's that belong to that Pool (regardless if you manaully set them or if VMM did it for you).  As a result, when you try to remove the Pool, you'll get another, more cryptic error. image
VMM is unable to delete the static IP address pool (VLAN50) because it has allocated IP addresses. Please return all the allocated IP addresses to the pool by using the Revoke-SCIPAddress cmdlet, and then retry this operation. You can retrieve the allocated addresses by using the Get-SCIPAddress cmdlet with the -StaticIPAddressPool parameter. ID: 13671
Since IP’s have been detected, VMM will not allow you to remove the IP pool from a Logical Network, but it does give you a hint on how you can force VMM to “forget” that the IP’s are out there by using Powershell to revoke them. image Run PowerShell from the VMM console to load all the System Center snapins and modules, then specify your subnet in the command below. $IPAddressPool = Get-SCStaticIPAddressPool -IPv4 -Subnet "" $IPAddress = Get-SCIPAddress -StaticIPAddressPool $IPAddressPool ForEach ($ip in $IPAddress) {Revoke-SCIPAddress -AllocatedIPAddress $ip} NOTE: This does not actually remove the IP’s from the Virtual Machines, it simply forces VMM to “forget” that they are in use.  Thanks goes to noisy82 in the TechNet forums for the script! image Now you can successfully remove the IP Pool and Virtual Network from VMM. N’joy!

Shannon Fritz

Infrastructure Architect & Server Team Lead