-
Retrieve Machine Information
[Originally posted by shirshendu paul]
sir,
how can i retrieve the mother board serial no or unique mashine id using visual basic.
iam using wmi scripting lib. but it is returning "0000000 " and in other machine it is blank
-
Re:Retrieve Machine Information
[Originally posted by neophile]
Did you already catch this?...
http://freevbcode.com/ShowCode.Asp?ID=2664
If so, I don't know what to do. However, you could get the serial number of a harddrive fairly easy...
Option Explicit
Private Declare Function GetVolumeInformation Lib "kernel32.dll" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Public Function DriveSerial(ByVal Drive As String) As Long
ÿ If Drive <> "" Then
ÿ ÿ ÿ Drive = UCase(Left(Drive, 1)) & ":\"
ÿ ÿ ÿ Call GetVolumeInformation(Drive, vbNullString, 0, DriveSerial, 0, 0, vbNullString, 0)
ÿ End If
End Function
Immediate Pane Example:
?DriveSerial("C")
939354681
-
Re:Retrieve Machine Information
[Originally posted by neophile]
Did you already catch this?...
http://freevbcode.com/ShowCode.Asp?ID=2664
If so, I don't know what to do. However, you could get the serial number of a harddrive fairly easy...
Option Explicit
Private Declare Function GetVolumeInformation Lib "kernel32.dll" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Public Function DriveSerial(ByVal Drive As String) As Long
ÿ If Drive <> "" Then
ÿ ÿ ÿ Drive = UCase(Left(Drive, 1)) & ":\"
ÿ ÿ ÿ Call GetVolumeInformation(Drive, vbNullString, 0, DriveSerial, 0, 0, vbNullString, 0)
ÿ End If
End Function
Immediate Pane Example:
?DriveSerial("C")
939354681
-
Also...
[Originally posted by neophile]
This might only work on motherboards that support the feature? Just a shot in the dark.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|