From Sql the following stored proceedure dilivers a lot of information including the number of cpus
EXEC xp_msver
From C# the following can be used
using System;
using System.Collections.Generic;
using System.Linq;using System.Text;
using System.Management;using System.Diagnostics;
namespace NumberOfProcessors
{
class Program
{
static void Main(string[] args)
{
ManagementObjectSearcher mgmtObjects = new ManagementObjectSearcher("Select * from Win32_ComputerSystem");
foreach (var item in mgmtObjects.Get())
{
Console.WriteLine("Number Of Processors - " + item["NumberOfProcessors"]);
try
{
Console.WriteLine("Number Of Logical Processors - " + item["NumberOfLogicalProcessors"]);
}
catch (ManagementException)
{ }
}
List
Console.WriteLine("All running process");
processes.ForEach(x => Console.WriteLine(x.ProcessName));
Console.ReadLine();
}
}}