UpdateInfoProvider Constructor |
Namespace: Xcalibur.WMI.Updates
1// Main 2private static void Main() 3{ 4 // Make a connection to the local machine 5 const string computer = "."; 6 var managementScope = new ManagementScope($@"\\{computer}\root\cimv2", new ConnectionOptions 7 { 8 Impersonation = ImpersonationLevel.Impersonate, 9 Authentication = AuthenticationLevel.Connect 10 }); 11 managementScope.Connect(); 12 13 // System information 14 var provider = new UpdateInfoProvider(managementScope); 15 16 // Fetch data 17 provider.Refresh(); 18 19 // Print results 20 foreach (var info in provider.Results) 21 { 22 Console.WriteLine($"{info.HotFixId}, {info.Description}, {info.InstalledBy}, {info.InstalledOn}"); 23 } 24 25 // Read 26 Console.Read(); 27} 28 29/* Results: 30 * 31 * KB4049179, Security Update, NT AUTHORITY\SYSTEM, 10/24/2017 32 * KB4051613, Update, NT AUTHORITY\SYSTEM, 11/2/2017 33 * KB4074595, Security Update, NT AUTHORITY\SYSTEM, 2/11/2018 34 * KB4074608, Update, NT AUTHORITY\SYSTEM, 2/11/2018 35 * KB4087256, Update, NT AUTHORITY\SYSTEM, 2/24/2018 36 * KB4074588, Security Update, NT AUTHORITY\SYSTEM, 2/24/2018 37 * 38 */