// GetProcessorReport.cs // // Reports Processor Info via WMI (Win32_Processor). // // Requires the System.Management package: // dotnet new console -o ProcessorReport // 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, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed FROM Win32_Processor"); int count = 0; foreach (ManagementObject item in searcher.Get()) { Console.WriteLine($"Name: {item["Name"]}"); Console.WriteLine($"NumberOfCores: {item["NumberOfCores"]}"); Console.WriteLine($"NumberOfLogicalProcessors: {item["NumberOfLogicalProcessors"]}"); Console.WriteLine($"MaxClockSpeed: {item["MaxClockSpeed"]}"); Console.WriteLine(new string('-', 40)); count++; } if (count == 0) { Console.WriteLine("No Processor Info found."); } else { Console.WriteLine($"\n{count} Processor Info found."); }