• C#得到CPU的序列号、硬盘序列号、网卡序列号


    //得到cpu信息
    public static void GetCpuIndex()
     {
                string _cpuInfo = "";
                ManagementClass cimobject = new ManagementClass("Win32_Processor");
                ManagementObjectCollection moc = cimobject.GetInstances();
                foreach (ManagementObject mo in moc)
                {
                    _cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
                }
                return _cpuInfo;
    }

    // 得到硬盘序列号

    public static void GetHDIndex()
     {
                string _HDInfo = "";
                ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive");
                ManagementObjectCollection moc1 = cimobject1.GetInstances();
                foreach (ManagementObject mo in moc1)
                {
                    _HDInfo = (string)mo.Properties["Model"].Value;


                }
                retrun _HDInfo;
    }

    //获取网卡硬件地址
     public static void GetMacAddress()
     {
                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();
                }
               
                return _MacAddress;
     }

  • 相关阅读:
    JAVA的界面(Swing)
    openlayers优化项
    常用软件下载
    最全的微软msdn原版windows系统镜像和office下载地址集锦
    常用WinPE
    Friends(老友记)(六人行)相关资源
    SAP初级书籍(PM相关)
    第8天:javascriptDOM小 案例、onmouseover 、onmouseout
    第7天:javascript-DOM 获取标签、注册事件改变属性的值、innerText、改变属性的值等
    第6天:数据Array
  • 原文地址:https://www.cnblogs.com/zhangtao/p/1972397.html
Copyright © 2020-2023  润新知