Visual Basic Development Bookmark and Share   
 Home > Visual Basic Language > Getting Unique Sytem ID
 

Getting Unique Sytem ID

Is there any way to get a system specific ID in vb.net?
Zishan J  Thursday, November 26, 2009 12:21 PM
Sort of. You can get a hard disk serial number. See this example:

http://www.vb-helper.com/howto_net_get_disk_serial_number.html

Or you can get the mother board's serial number:

http://www.vb-helper.com/howto_net_get_cpu_serial_number_id.html

You can also get things like the computer's name, but there's no guarantee that two systems won't have the same name.

Rod
www.vb-helper.com
Rod Stephens  Thursday, November 26, 2009 2:17 PM
Public Function createID() As String
Dim regPID As RegistryKey
Dim regGUID As RegistryKey
regPID = Registry.LocalMachine.OpenSubKey("hardware\description\system\bios", False)
regGUID = Registry.LocalMachine.OpenSubKey("hardware\description\system\bios", False)

Dim Pid As Object = Replace(regPID.GetValueKind("SystemFamily"), "-", "")

Dim GUID As Object = Replace(regGUID.GetValue("BaseBoardManufacturer"), "-", "")

DmilenPID As Integer
'Number of characters in ProductId.
lenPID = Len(Pid)
Dim lenGUID As Integer
'Number of characters in MachineGUID.
lenGUID = Len(GUID)


Dim tempValue As String
Dim strPID As String
Dim strGUID As String
Dim hardwareID As String


'Continues conversion to the end of the string length.
For x = 1 To lenPID
tempValue = Hex((Asc(Mid(Pid, x, 1)) Xor 23) Xor 14)
'Puts the ProductId and Xor'd Values together.
'ProductId first, then Xor'd Values come after.
'Note: This makes the ID longer.
strPID = strPID & tempValue
Next x
'Reverses the character/string order of ProductId.
strPID = StrReverse(strPID)

'Continues conversion to the end of the string length.
For x = 1 To lenGUID
tempValue = Hex((Asc(Mid(GUID, x, 1)) Xor 23) Xor 14)
'Puts the MachineGUID and Xor'd Values together.
'MachineGUID first, then Xor'd values come after.
'Note: This makes the ID longer.
strGUID = strGUID & tempValue
Next x

'Reverses the character/string order of MachineGUID.
strGUID = StrReverse(strGUID)
'Reverses MachineGUID back first, then adds the reversed
'character/string order of ProductId.
hardwareID = StrReverse(strGUID & strPID)
createID = hardwareID
End Function
  • Proposed As Answer byYou_ssif Monday, November 30, 2009 1:00 AM
  •  
You_ssif  Monday, November 30, 2009 1:00 AM

You can use google to search for other answers

Custom Search

More Threads

• how can i click a button on a website?
• how to convert image to bytearray, and back
• Decrypt a file
• Distorting an image
• Compare the listview item
• Help --- something's gone wrong with resources
• i am getting an exception
• What is the equivalent of C#'s "internal" keyword?
• synchronize the size and state of all the forms when window state is maximized and window state is normal using Visual Basic
• Edit Data in a .NET VS2005 Visual Basic ListView Control