Asp.net| Hard Drive
public static void Getcpuinfo (out string cpuInfo)
{
Get CPU Information
String _cpuinfo= "";//CPU information
ManagementClass cimobject = new ManagementClass ("Win32_Processor");
Managementobjectcollection MOC = Cimobject. GetInstances ();
foreach (ManagementObject mo in MOC)
{
_cpuinfo = mo. properties["Processorid"]. Value.tostring ();
}
Cpuinfo=_cpuinfo;
}
Get the hard drive ID
String _hdinfo= "";
ManagementClass Cimobject1 = new ManagementClass ("win32_diskdrive");
Managementobjectcollection Moc1 = Cimobject1. GetInstances ();
foreach (ManagementObject mo in Moc1)
{
_hdinfo = (string) mo. properties["Model"]. Value;
}
Hdinfo=_hdinfo;
}
public static void Getmacaddress (out string MacAddress)
{
Get the network card hardware address
String _macaddress= "";
ManagementClass mc = new ManagementClass ("Win32_NetworkAdapterConfiguration");
Managementobjectcollection MOC2 = MC. GetInstances ();
foreach (ManagementObject mo in moc2)
{
if ((bool) mo["ipenabled"] = = True)
macaddress=mo["MacAddress"]. ToString ();
Mo. Dispose ();
}
macaddress=_macaddress;
}