🟣 C# / .NET 6+
Get Computer System Info Report (C#)
Queries Win32_ComputerSystem via WMI (System.Management) and prints Computer System Info to the console.
GetComputerSystemReport.cs
// GetComputerSystemReport.cs
//
// Reports Computer System Info via WMI (Win32_ComputerSystem).
//
// Requires the System.Management package:
// dotnet new console -o ComputerSystemReport
// 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, Manufacturer, Model, TotalPhysicalMemory, NumberOfProcessors FROM Win32_ComputerSystem");
int count = 0;
foreach (ManagementObject item in searcher.Get())
{
Console.WriteLine($"Name: {item["Name"]}");
Console.WriteLine($"Manufacturer: {item["Manufacturer"]}");
Console.WriteLine($"Model: {item["Model"]}");
Console.WriteLine($"TotalPhysicalMemory: {item["TotalPhysicalMemory"]}");
Console.WriteLine($"NumberOfProcessors: {item["NumberOfProcessors"]}");
Console.WriteLine(new string('-', 40));
count++;
}
if (count == 0)
{
Console.WriteLine("No Computer System Info found.");
}
else
{
Console.WriteLine($"\n{count} Computer System Info found.");
}