概述
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();
}
}
// 得到硬盘序列号
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;
}
转载于:https://www.cnblogs.com/JohnXIe/archive/2008/10/23/1318055.html
最后
以上就是风趣夕阳为你收集整理的C#得到CPU的序列号、硬盘序列号、网卡序列号的全部内容,希望文章能够帮你解决C#得到CPU的序列号、硬盘序列号、网卡序列号所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复