获取cpu序列号,硬盘id,网卡mac地址 _c#应用

2008-02-23 05:43:02来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

private void GetInfo()
{
string cpuInfo = "";//cpu序列号
ManagementClass cimobject = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = cimobject.GetInstances();
foreach(ManagementObject mo in moc)
{
cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
Response.Write ("cpu序列号:" cpuInfo.ToString ());
}

//获取硬盘ID
String HDid;
ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");
ManagementObjectCollection moc1 = cimobject1.GetInstances();
foreach(ManagementObject mo in moc1)
{
HDid = (string)mo.Properties["Model"].Value;
Response.Write ("硬盘序列号:" HDid.ToString ());
}


//获取网卡硬件地址
9558821702001755616


ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc2 = mc.GetInstances();
foreach(ManagementObject mo in moc2)
{
if((bool)mo["IPEnabled"] == true)
Response.Write("MAC address\t{0}" mo["MacAddress"].ToString());
mo.Dispose();
}
}


标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇: 在指定应用程式域中执行代码_c#应用

下一篇: javascript 操作 listbox 的问题_c#应用