5
  1. 什么是 PC 唯一 ID?
  2. 我们如何获得 PC unqiue ID?
  3. 是硬盘还是主板?

我想将 PC ID 存储在我的窗口程序中。请分享给我。

4

5 回答 5

6

这对我有用

Private Function CpuId() As String
    Dim computer As String = "."
    Dim wmi As Object = GetObject("winmgmts:" & _
        "{impersonationLevel=impersonate}!\\" & _
        computer & "\root\cimv2")
    Dim processors As Object = wmi.ExecQuery("Select * from " & _
        "Win32_Processor")

    Dim cpu_ids As String = ""
    For Each cpu As Object In processors
        cpu_ids = cpu_ids & ", " & cpu.ProcessorId
    Next cpu
    If cpu_ids.Length > 0 Then cpu_ids = _
        cpu_ids.Substring(2)

    Return cpu_ids
End Function

这里

于 2015-04-22T09:15:38.287 回答
2

试试这个,它会从处理器中提取 ID。

Dim win32MgmtClass as System.Management.ManagementClass
win32MgmtClass = new System.Management.ManagementClass("Win32_Processor")
Dim processors as System.Management.ManagementObjectCollection
processors = win32MgmtClass.GetInstances()

For Each processor As System.Management.ManagementObject In processors
    MessageBox.Show(processor("ProcessorID").ToString())
Next
于 2011-09-26T03:40:49.637 回答
0

“PC 唯一 ID”通常是指硬件 ID,用于唯一标识一台计算机。例如,它们可用于跟踪计算机上的软件使用情况。

根据这个问题,“主板id、处理器id和bios id”“最不可能改变”。

此问题包含在 C# 中获取此类信息的代码;不幸的是,我找不到任何 VB.NET 的主题,但它应该很容易移植。

于 2011-09-26T03:34:27.657 回答
0

我假设你想生成一个机器唯一的 ID。硬盘驱动器可能是最简单的方法,因为其他硬件种类繁多,没有一套检索其序列号的方法。

可能最简单的方法是使用 Windows 为硬盘驱动器生成的数字。

您可以在 HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices 下找到它,键名是 \DosDevices\C:(假设 C: 驱动器是主系统驱动器 - 在极少数情况下并非如此,但随后您可以检查系统驱动器是什么并使用适当的密钥)。

还有另一个与硬盘相关的数字,称为 UUID,您可以找到脚本来获取它。例如: http: //www.windowsnetworking.com/articles_tutorials/Deploying-Windows-7-Part18.html适用于 Windows。或者http://blog.granneman.com/2007/07/26/find-out-a-hard-drives-uuid/对于 Linux。

我还发现了这篇关于检索主板序列号的文章:通过 vc++ 编程获取主板唯一 ID 号

于 2011-09-26T03:42:53.250 回答
0

需要 https://www.nuget.org/packages/System.Management/

系统管理 4.7.0

如您所见,有一个“唯一值”加上一些特殊计算。你可以尽可能地做到这一点,但逆向工程最终会暴露这一点。

计算机 ID 的更好(但更慢)版本(需要 System.Management 导入和引用):代码:

    Public Shared Function GetComputerID() As Long
        Dim objMOS As New ManagementObjectSearcher("Select * From Win32_Processor")
        For Each objMO As Management.ManagementObject In objMOS.Get
            GetComputerID += objMO("ProcessorID").GetHashCode
        Next
        GetComputerID += My.Computer.Name.GetHashCode
    End Function
于 2020-11-29T23:51:50.363 回答