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.
Select Start > Settings > Update & Security > Windows Update , and then select Check for updates.
Windows 10 current version information This feature update is known as the “November 2021 Update,” it's been available since November 16, 2021, and the latest quality update is “build 19044.2006.” You can use these instructions to check the version installed on your device.
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
Each key has a LastSuccessTime
value you can use.
On Windows 7, 8, 10 you can use following code:
var auc = new AutomaticUpdatesClass();
DateTime? lastInstallationSuccessDateUtc = null;
if (auc.Results.LastInstallationSuccessDate is DateTime)
lastInstallationSuccessDateUtc = new DateTime(((DateTime)auc.Results.LastInstallationSuccessDate).Ticks, DateTimeKind.Utc);
DateTime? lastSearchSuccessDateUtc = null;
if (auc.Results.LastSearchSuccessDate is DateTime)
lastSearchSuccessDateUtc = new DateTime(((DateTime)auc.Results.LastSearchSuccessDate).Ticks, DateTimeKind.Utc);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With