Thursday, December 2, 2010

Get System Processor Id for some validations

Firstly Make sure that you have added system.Management namespace and assembly.

public static string GetProcessorID()

string sProcessorID = "";

string sQuery = "SELECT ProcessorId FROM Win32_Processor";

ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery);

ManagementObjectCollection oCollection = oManagementObjectSearcher.Get();
foreach (ManagementObject oManagementObject in oCollection)


sProcessorID = (string)oManagementObject["ProcessorId"];

return (sProcessorID);


No comments:

Post a Comment