Search code examples
c#.netwindows-update

Check when last check for Windows Updates was performed


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.


Solution

  • 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.