文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C#应用:获取cpu序列号,硬盘ID,网卡MAC地址

C#应用:获取cpu序列号,硬盘ID,网卡MAC地址

时间:2011-05-27  来源:EveryMan

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();
   }
  }

相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载