Skip to content

Instantly share code, notes, and snippets.

@ChrisLynchHPE
Last active October 21, 2019 17:24
Show Gist options
  • Save ChrisLynchHPE/838604061682836466cd64dc2991f420 to your computer and use it in GitHub Desktop.
Save ChrisLynchHPE/838604061682836466cd64dc2991f420 to your computer and use it in GitHub Desktop.
This script will invoke the IP Pool Collector service that will attempt to reclaim addresses that were not released during resource removal. Example resources that can consume IPv4 Addresses from pools are Logical Enclosures, OS Deployment Servers and Hypervisor Cluster Profiles.
# Replace the -NetworkID parameter with the right Subnet Pool ID to reclaim addresses
$subnet = Get-HPOVAddressPoolSubnet -NetworkId 10.41.87.0
ForEach ($range in $subnet.rangeUris)
{
$_Uri = $range + '/allocated-fragments?start=0&count=1'
$_AllocatedFragments = Send-HPOVRequest -uri $_Uri
$_Uri = $range + '/collector'
$Body = @{idList = @($_AllocatedFragments.members[0].startAddress)}
Send-HPOVRequest -Uri $_Uri -Body $Body -Method PUT
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment