Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Machine Identification

Posted on 2001-07-23
Medium Priority
Last Modified: 2012-05-07
Hi experts,

I need to uniquely identify a computer system. I need this for generating a unique value based on the hardware, it could be the network card number or probably the CPU speed.

Literally anything that does not change when the system is formatted. I am currently using ActiveLock but every time you format the system the ActiveLock key changes. I hope that my requirement is clear.

Thankx for any help in advance
Question by:Murtuza111000
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 43

Accepted Solution

TimCottee earned 300 total points
ID: 6308342
Use the MAC address of the machine itself:


Author Comment

ID: 6308356
That was really very quick TimCottee, I will checkout the link

Author Comment

ID: 6308367
Went thru the project, but would this work on a system where there is no network card installed.
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Expert Comment

ID: 6308858
LVL 28

Expert Comment

ID: 6310821
'For w95/98 via direct memory access.NT/2000 doesn't map
'these addresses into process space, so this code cause GPF.
'See section below how to get these info for NT/2000.

Option Explicit
Private Type BiosData
  Date As Date
  Manufacturer As String
  Version As String
End Type

'Change following declaration to fit your vb version

Private Declare Sub GetMem1 Lib "msvbvm50.dll" (ByVal MemAddress As Long, var As Byte)

Private Function GetBIOSData() As BiosData
 Dim p As Byte, MemAddr As Long, sBios As String
 Dim i As Integer
 sBios = "" 
 MemAddr = &HFE061
 For i = 0 To 25
     Call GetMem1(MemAddr + i, p)
     If p = 0 Then p = 32
     sBios = sBios & Chr$(p)
 Next i
 GetBIOSData.Version = sBios
 MemAddr = &HFFFF5
 sBios = "" 
 For i = 0 To 7
     Call GetMem1(MemAddr + i, p)
     If p = 0 Then p = 32
     sBios = sBios & Chr$(p)
 Next i
 GetBIOSData.Date = CDate(sBios)
 MemAddr = &HFE030
 sBios = "" 
 For i = 0 To 18
     Call GetMem1(MemAddr + i, p)
     If p = 0 Then p = 32
     sBios = sBios & Chr$(p)
 Next i
 GetBIOSData.Manufacturer = sBios
End Function

Private Sub Form_Load()
 Dim bd As BiosData
 bd = GetBIOSData
 Text1 = "BIOS date = " & bd.Date & vbCrLf & "Manufacturer = " & bd.Manufacturer & vbCrLf & "BIOS ver.
= " & bd.Version
End Sub

' For all platforms via registry reading. Can not check on NT, but you can just search your registry using regedit
and change data location in code:

---Bas module code---
Private Const REG_SZ As Long = 1
Private Const REG_DWORD As Long = 4
Private Const HKEY_LOCAL_MACHINE As Long = &H80000002

Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal
lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As
Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData
As Long) As Long

Private Function regQuery_A_Key(ByVal hKey As Long, ByVal sRegKeyPath As String, ByVal sRegSubKey As
String) As Variant
 Dim iPos As Integer
 Dim lKeyHandle As Long
 Dim lRet As Long
 Dim lDataType As Long
 Dim lBufferSize As Long
 Dim lBuffer As Long
 Dim sBuffer As String
 Dim arBuffer() As Byte
 lKeyHandle = 0
 lBufferSize = 0
 regQuery_A_Key = "" 
 lRet = RegOpenKey(hKey, sRegKeyPath, lKeyHandle)
 If lKeyHandle = 0 Then GoTo FuncFail
 lRet = RegQueryValueEx(lKeyHandle, sRegSubKey, 0&, lDataType, ByVal 0&, lBufferSize)
 If lKeyHandle = 0 Then GoTo FuncFail
 Select Case lDataType
        Case REG_SZ:       ' String
             sBuffer = Space(lBufferSize)
             lRet = RegQueryValueEx(lKeyHandle, sRegSubKey, 0&, 0&, ByVal sBuffer, lBufferSize)
             If lRet = ERROR_SUCCESS Then
                iPos = InStr(1, sBuffer, Chr(0))
                If iPos > 0 Then
                    regQuery_A_Key = Left(sBuffer, iPos - 1)
                    regQuery_A_Key = sBuffer
                End If
             End If
        Case REG_DWORD:
             lRet = RegQueryValueEx(lKeyHandle, sRegSubKey, 0&, lDataType, lBuffer, 4&)            
                           ' 4& = 4-byte word (long integer)
             If lRet = ERROR_SUCCESS Then
                regQuery_A_Key = lBuffer
             End If
        Case Else:
 End Select
lRet = RegCloseKey(lKeyHandle)
End Function

Public Function GetBiosVer() As String
  GetBiosVer = regQuery_A_Key(HKEY_LOCAL_MACHINE, "Enum\Root\*PNP0C01\0000", "BiosVersion")
End Function

Public Function GetBiosDate() As String
  GetBiosDate = regQuery_A_Key(HKEY_LOCAL_MACHINE, "Enum\Root\*PNP0C01\0000", "BiosDate")
End Function

Public Function GetBiosMfr() As String
GetBiosMfr = regQuery_A_Key(HKEY_LOCAL_MACHINE, "Enum\Root\*PNP0C01\0000", "BiosName")
End Function

'--- Form code---
' Add one command button at form
Private Sub Command1_Click()
Me.Print "BiosDate = "; GetBiosDate
Me.Print "BiosVersion = "; GetBiosVer
Me.Print "BiosName = "; GetBiosMfr
End Sub


Author Comment

ID: 6321385

Thank you for this peice of code,I checked it on a Win98 system and it runs fine, but the alternate method on a WinNT4.0 and Windows2000 does not seen to work. There is no registry key PNP0C01\0000 on any of the winnt systems

I find HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\Root\*PNP0C01\PnPBIOS_8 key on a WinNT2000 system but again this no values like "BiosDate",BiosName" and "BiosVersion"

And again even if I do locate these entries in the registry, they are editable values by the user, now that is a different question how many users may actually play around these values, and also that system might be refreshing the values at boot.

TimCottee's solution might work only on systems that have a network card. something similar that might work on systems without network card would be perfect.

Author Comment

ID: 6321395

TimCottee's solution might work only on systems that have a network card. something similar that might
work on systems without network card would be perfect.

TimCottee's solution does not work on systems that do not have a network card.

Author Comment

ID: 6354870
Thank you Ark for the suggestion, but as I mentioned that this approach has its pitfall, although TimCottee's partially answers my question but that is something what I am looking for.

I think I will settle for TimCottee's suggestion.

Thank you for the help.

Author Comment

ID: 6354873
Do let me know If my question can be fully answered


Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question