Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

[VB2010] Unique number from hardware pc

$
0
0
Surfing the web i read that with this code:

Code:

    Public Function GetProcessorID() As String

        Dim sProcessorID As String = ""
        Dim sQuery As String = "SELECT ProcessorId FROM Win32_Processor"
        Dim oManagementObjectSearcher As ManagementObjectSearcher = Nothing

        Try
            oManagementObjectSearcher = New ManagementObjectSearcher(sQuery)
            Dim oCollection As ManagementObjectCollection = oManagementObjectSearcher.[Get]()
            For Each oManagementObject As ManagementObject In oCollection
                sProcessorID = DirectCast(oManagementObject("ProcessorId"), String)
            Next
            oCollection.Dispose()
            Return (sProcessorID)

        Catch ex As Exception
            Debug.Print("GetProcessorError: " & ex.ToString)

        Finally
            sProcessorID = Nothing
            sQuery = Nothing
            If Not oManagementObjectSearcher Is Nothing Then oManagementObjectSearcher.Dispose()
        End Try

    End Function

I would have to find the SERIAL NUMBER of the CPU, and so a UNIQUE number. But this is NOT true. Running this simple code on 5 PCs in my office, I have found 3 same IDs on PSc with same processor.

So this is NOT the serial number, but the type of CPU.

Some idea of how to extract a REALLY unique number from a PC?

Ty :)

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>