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();
}
}
新闻热点
疑难解答