Check when last check for Windows Updates was performed

Kjensen picture Kjensen · Feb 9, 2012 · Viewed 9k times · Source

How can I check WHEN last check for windows updates was performed - in code (c#/.Net)?

Not WHICH updates are or are not installed, but WHEN last check was performed?

Best of all would be a complete history of when checks for windows updates had been performed, but I can certainly live with only knowing the last check.

Answer

John Koerner picture John Koerner · Feb 9, 2012

Look at this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results

It has 3 sub keys that each provide different information about the different events

  • Detect
  • Download
  • Install

Each key has a LastSuccessTime value you can use.