I am trying to get LastInstallationSuccessDate and LastSearchSuccessDate from the Windows Update API through .Net. I can get IAutomaticUpdates2.Results, but those two properties contained within it are null. Why aren’t they date’s like the documentation states?
class Program
{
static void Main(string[] args)
{
WUApiLib.IAutomaticUpdates2 auc = new WUApiLib.AutomaticUpdates();
Console.WriteLine(auc.Results.LastInstallationSuccessDate);
Console.WriteLine(auc.Results.LastSearchSuccessDate);
}
}
Though the LastInstallationSuccessDate and LastSearchSuccessDate exist in the COM interface they are not supported in Windows XP and always return null.
Likewise the
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\InstallLastSuccessTimeandHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Detect\LastSuccessTimeregistry values do not exist in Windows XP.It appears that parsing %windir%\SoftwareDistribution\ReportingEvents.log could be used to approximate this functionality, but special consideration to performance should be taken since the file can grow to be very large.