// BackupQuickFixEngineeringListToJson.cs // // Snapshots Installed Hotfixes (Win32_QuickFixEngineering) to a timestamped JSON file. // // Requires the System.Management package: // dotnet new console -o BackupQuickFixEngineering // dotnet add package System.Management // (replace the generated Program.cs with this file, then dotnet run) using System; using System.Collections.Generic; using System.IO; using System.Management; using System.Text.Json; var searcher = new ManagementObjectSearcher("SELECT HotFixID, Description, InstalledOn, InstalledBy FROM Win32_QuickFixEngineering"); var results = new List>(); foreach (ManagementObject item in searcher.Get()) { var row = new Dictionary(); row["HotFixID"] = item["HotFixID"]; row["Description"] = item["Description"]; row["InstalledOn"] = item["InstalledOn"]; row["InstalledBy"] = item["InstalledBy"]; results.Add(row); } string timestamp = DateTime.Now.ToString("yyyyMMdd-HHmmss"); string outPath = $"quickfixengineering-snapshot_{timestamp}.json"; File.WriteAllText(outPath, JsonSerializer.Serialize(results, new JsonSerializerOptions { WriteIndented = true })); Console.WriteLine($"Snapshot of Installed Hotfixes ({results.Count} items) saved to {outPath}");