Reputation: 1830
I need a function that returns a String, using the hardware serial numbers and mixing them together to obtain a single serial number.
I searched try a function like this but I can not find anything similar, this function need to identify a pc with a licensing system.
I only need a same value per computer.
Upvotes: 0
Views: 69
Reputation: 8031
This may not be exactly what you want but if i understand your question correctly, play around with the below code (Don't use the code below with Strict On) not the best of ideas but it works...
Private Function SystemSerialNumber() As String
' Get the Windows Management Instrumentation object.
Dim wmi As Object = GetObject("WinMgmts:")
' Get the "base boards" (mother boards).
Dim serial_numbers As String = ""
Dim mother_boards As Object = _
wmi.InstancesOf("Win32_BaseBoard")
For Each board As Object In mother_boards
serial_numbers &= ", " & board.SerialNumber
Next board
If serial_numbers.Length > 0 Then serial_numbers = _
serial_numbers.Substring(2)
Return serial_numbers
End Function
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
Source: http://www.vb-helper.com/howto_net_get_cpu_serial_number_id.html
Upvotes: 1