I am trying to get a CPU ID Using managementobjectserarcher but I am getting an error of object reference not found instance of an object exception. The sample code has been written manually so may be some spelling mistake. but it is compiling properly.
please help me to get rid of this.
ManagementObjectSearcher obj = new ManagementObjectSearcher("Select * from Win32_processor")
foreach(ManagementObject ob in obj.Get())
Console.write(ob["ProcessorID"].toString());