Azure Pack Hyper-V Powershell SCVMM Windows Server

Deleting Virtual Network fails due to assigned IP address – SCVMM

Had a request today where a tenant was trying to delete a virtual network but they received an error saying there were dependent IP addresses but they have no IP addresses listed in the network.

Using my current favourite PowerShell feature, Out-GridView, we can quickly script the revocation of the naughty IP address..

Note: Change the VMM variable to suit your environment

So I ran the below to find the IP..

$VMM = Get-SCVMMServer –ComputerName <name of vmm> 
Get-SCIPAddress –VMMServer $VMM | where {$_.Description -like "HNV*"} | FT Name, Description, AllocatingAddressPool

But it wasn’t listed.. Not sure what happened here.

So let’s query the IP address pool directly.

$VMM = Get-SCVMMServer –ComputerName <name of vmm> 
$IPPool = Get-SCStaticIPAddressPool -VMMServer $VMM | Out-GridView


Ok, I now see the orphaned IP address. So let’s revoke it….

$VMM = Get-SCVMMServer –ComputerName <name of vmm> 
$IPPool = Get-SCStaticIPAddressPool -VMMServer $VMM | Out-GridView -PassThru 
Get-SCIPAddress –VMMServer $VMM -StaticIPAddressPool $IPPool | Revoke-SCIPAddress 

Once done, check the VM Network for any other dependencies to ensure there is nothing else left over, then you should be able to advise the tenant that they can delete the virtual network.

Apologies for the lack of screenshots, posting this was an after thought..


Leave a Reply