Get Email Alerts for DHCP Scope Full Warnings in Windows Server 2012/2016

Windows DHCP servers used to have email alert functionality built-into the task creation process when events are triggered. Here are steps to use a PowerShell script to replace this functionality and how to customize it. This was split on several different posts, so consolidating it here.

1. PowerShell script – From Cazi Brasga

#DHCP Percent of Addresses Remaining Threshold
$DHCPLowPercentThreshold = 10
#From Email Address
$FromAddress = "dhcpalert@domain.com"
#To Email Address
$ToAddress = "user@domain.com"
#SMTP Server Address
$SmtpServerAddress = "mail.domain.com"

$5MinutesAgo = [DateTime]::Now.AddMinutes(-5)
$DHCPLowEvent = @(Get-EventLog -LogName "System" -After $5MinutesAgo -InstanceID 1020)[0]
$DHCPLowEventMessage = $DHCPLowEvent.Message
$DHCPLowPercent = 100 - $DHCPLowEvent.ReplacementStrings[1]
If ($DHCPLowPercent -le $DHCPLowPercentThreshold){
$messageParameters = @{ 
Subject = "Warning: DHCP Addresses Low" 
Body = "$DHCPLowEventMessage"
From = $FromAddress
To = $ToAddress
SmtpServer = $SmtpServerAddress
} 
Send-MailMessage @messageParameters
}

2. Run your task from “System” user account, so that you do not have to be logged on with your account to run the task.

3. Finally, adjust the threshold of alerting you want.

Open Regedit.exe
Navigate to this path
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dhcpserver\Parameters\
Create a REG_DWORD (32 bit) value named DhcpAlertPercentage under Parameters
set it to 85 or 90 (decimal)
Lastly, restart the DHCP service for the change to become active.

Two fun Google Maps Travel Games – Get lost and find your location

Have you ever wanted to travel to random places on a map?
Do you virtual travel using street view on Google or Bing maps?

There’s a site called GeoGuessr that will drop you in a random location on earth, and your goal is to put a pin on a map where you think you started out. It’s fascinating to see the different locations and towns out there. It’s also a good reminder that there is a TON of unpopulated areas still left on earth.

A second site is called MapCrunch and it will also drop you in a random map location, but without the “guess on a map” feature. I mention it because you can narrow down specific countries you’d like to randomly end up in, as well as other options that GeoGuessr doesn’t have.

Check them both out!  If anyone knows any additional fun games like these, please post them in the comments.

The answer to “How Much Wood Would a Woodchuck Chuck?”

One of the age’s great questions may have finally been solved:
“How much wood would a woodchuck chuck, if a woodchuck could chuck wood?”

 

A recent Reddit comment thread featured two users that did the math to come up with the answer of 1 Cubic Meter.

Continue reading The answer to “How Much Wood Would a Woodchuck Chuck?”