Mike Suding

Windows Patches needed

Recommended Posts

N7R7YZ

See details on my blog .  A DataSource that shows which Windows patches are needed. The patch names, and KB numbers show as instances and are grouped by Microsoft's 'classifications'. A special instance named 'summary' shows how many days since the last patch was installed and how many patches are needed.

image.png.cc8d13bb7a59ff7a5d94cfba40e70854.png

Share this post


Link to post
Share on other sites

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
    }
    
Edited by Mosh

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now