This might take you < 1 minute to read.

I did create a  DHCP scopes a couple of days ago. Something happened after the creation and a some scopes had a range of leases that got higher than 240, which was my top lease. The DHCP service had 70 scopes on two servers. This meant that I needed to check 140 scopes. First thing I rerun the script in previous post and set the top lease to 240, again, and Second I created a script to look for leases over 240 for me. It is not pretty, but it does its job.

What i t does is get all leases over 240

$a =( (get-dhcpserverv4scope | Get-DhcpServerv4Lease ).ipaddress).ipaddresstostring
foreach ($ip in $a) {
$sep = $ip.lastindexof(".")
$network = $ip.substring(0,$sep)
$node = $ip.substring($sep+1)
if ([int]$node -ge 240) {
$ip
}
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.