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.

Why is Google Maps still the Top?

Google Maps is one of Google’s products that nobody else has seemed to be able to match yet. The amount of detail and extra data collection that Google has undertaken is multitudes more than the competitors.

This post below from 2017 goes into some of the details. While outdated slightly as HERE maps is able to compete better, it goes to show how much Google can accomplish when combining multiple data sources.

https://www.justinobeirne.com/google-maps-moat

It’s no surprise then, that when these companies combine our personal data, they can also get scary accurate results.

Fix for T-Mobile MMS not working with Wifi [Calling] connected. (Group and Picture texts)

I like to buy my own phones and bring them to my plan. Sometimes this results in not having the full config to make the phone work 100% on a carrier. I recently fixed issues where I could not receive MMS messages if I had an active wifi connection. When my phone is on wifi, it chooses to send and receive messages and calls over wifi instead of the cellular service. Unfortunately, I was missing this in my APN config!

APN settings: (Changes I made to my settings in brackets. Full quote is from source)
Name: T-Mobile US LTE
APN: fast.t-mobile.com
Proxy: Not set
Port: Not set
Username: Not set
Password: Not set
Server: Not set
MMSC: http://mms.msg.eng.t-mobile.com/mms/wapenc [ADDED THIS]
Multimedia message proxy: Not set
Multimedia message port: 80 [ADDED THIS]
MCC: 310
MNC: 260
Authentication type: None
APN type: default,mms,supl [ADDED mms to my existing list]
APN protocol: IPv6
APN roaming protocol: IPv4
Enable/disable APN: APN enabled
Bearer: Unspecified
Mobile virtual network operator type: None
Mobile virtual network operator value: Not set

Source: https://support.t-mobile.com/message/626402#626402