how to get PC unique id?

soclose picture soclose · Sep 26, 2011 · Viewed 26.5k times · Source
  1. What is the PC unique ID?
  2. How could we get the PC unqiue ID?
  3. Is it about Hard disk or motherboard?

I'd like to store PC ID in my window program. Please share me.

Answer

Sajitha Rathnayake picture Sajitha Rathnayake · Apr 22, 2015

This work for me

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

see here