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

Hello,

Excellent post thanks!

I wonder if we could add the KB# in the datapoint or there is another way to get them in a widget?

Thanks,

Dom

Share this post


Link to post
Share on other sites

The KB# appears to be the first part of the instance name. I haven't looked at the code, but you could likely modify it to store the KB# as an instance level property.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.