Monday, May 2, 2016

Monitor RID pool with PRTG

Exhausting your domain RID pool is lose-your-job kinda bad, and there are rare circumstances where you can rapidly use up the RID pool. In a situation like that you need to quickly find the offending DC and shut it down. To help keep an eye on this I made a custom Powershell sensor for PRTG which pulls the RID pool information from a DC. You might need to download dcdiag.exe from Microsoft, and regardless you'll need to copy it to C:\Sensors if you want to use the script verbatim. Unfortunately, Powershell x86 had a really hard time using dcdiag any other way. I made a script for each of my DCs.

C:
CD\
CD Sensors

$PRTGRID = .\dcdiag.exe /s:<DC> /test:ridmanager /v | find /i "rIDAllocationPool is" | % {$_.substring($_.length-5) -replace '^[a-z]'}

write-host $PRTGRID,":OK"