在用System.Management.ManagementClass取出的CPU信息中的SystemName是代表什么意思?

javamy018 2013-01-30 10:41:45

static string A()
{
System.Management.ManagementClass mc = new System.Management.ManagementClass("win32_processor");
System.Management.ManagementObjectCollection moc = mc.GetInstances();
string str = "";
foreach (System.Management.ManagementObject mo in moc)
{
if (mo.Properties["Name"] != null
&& mo.Properties["Name"].Value != null)
{
Console.WriteLine("Name ................ : {0}", mo["Name"].ToString());
}

if (mo.Properties["Caption"] != null
&& mo.Properties["Caption"].Value != null)
{
Console.WriteLine("Caption ............. : {0}", mo["Caption"].ToString());
}

if (mo.Properties["processorid"] != null
&& mo.Properties["processorid"].Value != null)
{
Console.WriteLine("ProcessorID ......... : {0}", mo["processorid"].ToString());
}
if (mo.Properties["SystemName"] != null
&& mo.Properties["SystemName"].Value != null)
{
Console.WriteLine("SystemName .......... : {0}", mo["SystemName"].ToString());
}

}
return str.Trim();
}

结果:
-----------------------------------------------------------
-- CPU信息
-----------------------------------------------------------
Name ................ : Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Caption ............. : Intel64 Family 6 Model 42 Stepping 7
ProcessorID ......... : BFEBFBFF000206A7
SystemName .......... : 4TJXU4U4EWFGFNP


因为发现同型号的CPU的ProcessorID 是相同的
所以不知道SystemName 这个是否能来做唯一标示

谢谢
...全文
327 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
bdmh 2013-01-30
  • 打赏
  • 举报
回复
SystemName Data type: string Access type: Read-only Name of the scoping system. This property is inherited from CIM_LogicalDevice. http://msdn.microsoft.com/en-us/library/aa394373(VS.85).aspx
获取U盘ID序列号 VS2005编译通过,源码源自CSDN。已经测试好用。 可以获得U盘名称,制造商ID号 版本号 U盘序列号及容量 Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Management; namespace UDiskTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { DriveInfo[] s = DriveInfo.GetDrives(); foreach (DriveInfo drive in s) { if (drive.DriveType == DriveType.Removable) { pf.Text = drive.Name.ToString(); break; } } ManagementClass cimobject = new ManagementClass("Win32_DiskDrive"); ManagementObjectCollection moc = cimobject.GetInstances(); foreach (ManagementObject mo in moc) { if (mo.Properties["InterfaceType"].Value.ToString() == "USB") { try { //产品名称 Caption.Text = mo.Properties["Caption"].Value.ToString(); //总容量 Size.Text = mo.Properties["Size"].Value.ToString(); string[] info = mo.Properties["PNPDeviceID"].Value.ToString().Split('&'); string[] xx = info[3].Split('\\'); //序列号 MessageBox.Show("U盘序列号:" + xx[1]); PNPDeviceID.Text = xx[1]; xx = xx[0].Split('_'); //版本号 REV.Text = xx[1]; //制造商ID xx = info[1].Split('_'); VID.Text = xx[1]; } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } } } 如果编译遇到问题是using System.Management;无法找到引用找到, 项目(p)->添加引用(R)->找到.NET标签页 列表下部位找到System.Management 双击点确定

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧