Hi there,
after some time unused IPs will accumulate in your IP Pools. To free them of their caged misery and more importantly give them back for further usage you can use some simple powershell code to achieve this.
An IP Pool will look something like this after some time. Without the customizations in Paint obviously 😉
You could select each IP in each pool and use the little release button at the bottom (fun, if you like repetetive tasks), but with this little one liner you will get rid of all unassigned IPs at once.
1 |
Get-SCIPAddress | Where-Object State -EQ UnAssigned | Revoke-SCIPAddress -ReturnToPool $true |
You can also set this script up, as a scheduled task to run it every day.
1 2 3 |
$Task = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument '-NoProfile -WindowStyle Hidden -command "& c:\temp\SCVMMIPPCleanup.ps1}"' $trigger = New-ScheduledTaskTrigger -Daily -At "2:00 AM" Register-ScheduledTask -Action $Task -Trigger $trigger -TaskName "Cleanup SCVMM IP Pools" -Description "Cleanup SCVMM IP Pools - runs daily" |
After that your IPs are free again and can roam your IP ranges as they should!
Cheers Philipp
One thought on “How to return unused IPs to a SCVMM IP Pool – with PowerShell”