🟣 C# / .NET 6+
Get Installed MSI Products Report (C#)
Queries Win32_Product via WMI (System.Management) and prints Installed MSI Products to the console.
GetProductReport.cs
// GetProductReport.cs
//
// Reports Installed MSI Products via WMI (Win32_Product).
//
// Requires the System.Management package:
// dotnet new console -o ProductReport
// dotnet add package System.Management
// (replace the generated Program.cs with this file, then dotnet run)
// On .NET Framework, System.Management is already available — just
// add a reference to it in your project.
using System;
using System.Management;
var searcher = new ManagementObjectSearcher("SELECT Name, Version, Vendor, InstallDate FROM Win32_Product");
int count = 0;
foreach (ManagementObject item in searcher.Get())
{
Console.WriteLine($"Name: {item["Name"]}");
Console.WriteLine($"Version: {item["Version"]}");
Console.WriteLine($"Vendor: {item["Vendor"]}");
Console.WriteLine($"InstallDate: {item["InstallDate"]}");
Console.WriteLine(new string('-', 40));
count++;
}
if (count == 0)
{
Console.WriteLine("No Installed MSI Products found.");
}
else
{
Console.WriteLine($"\n{count} Installed MSI Products found.");
}