vb Code:
Set WMIObjectSet = GetObject("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_PhysicalMedia")
For Each wmiobject In WMIObjectSet
s = wmiobject.SerialNumber
sn = ""
If Not IsNull(s) Then
If Len(s) > 20 Then
For i = 1 To Len(s) Step 4 ' windows 7
sn = sn & Chr("&h" & Mid(s, i + 2, 2)) & Chr("&h" & Mid(s, i, 2))
Next
ElseIf Len(s) = 20 Then
For i = 1 To Len(s) Step 2 ' vista
sn = sn & Mid(s, i + 1, 1) & Mid(s, i, 1)
Next
Else: sn = s ' where string returned directly
End If
MsgBox wmiobject.Tag & " : " & Trim(sn)
End If
Next
Set WMIObjectSet = Nothing
End Sub
And provide me the solution "api version that asks for elevation
you need to follow all instructions for adding manifests to your exe, these are discussed in many places in this forum, all apps should now have this to be vista and windows 7 aware, as this is not just some vb code, but requires a tutorial, you will need to research it