Hi @Mike Suding
I have found that sometimes it is possible to get a false $DayDiff when going by the most recently installed update. I found an example on a server where an older roll-up was installed recently and the returned date was way in the past. So, I'm using the following method, which so far has been returning the expected results:
$LAST_UPDATE_KEY_PATH = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Detect"
If (Test-Path -Path $LAST_UPDATE_KEY_PATH)
{
$lastSuccessTime = [datetime](Get-ItemProperty -Path $LAST_UPDATE_KEY_PATH -name "LastSuccessTime").LastSuccessTime
$DayDiff = $(New-TimeSpan -start $lastSuccessTime).Days
}
else
{
$DayDiff = -1
}