Hi there,
Here is my vbs code to read HD serial number. The WMI return only a unintelligible byte value. So I've written a conversion function.
----------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
str = ""
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMedia")
For Each objItem In colItems
str = objItem.SerialNumber & vbCrlf & vbCrlf
msgbox( "Serial Number : " & ConvertSN(Str))
next
Function ConvertSN(Str)
DIM Hxstr
DIM i
Hxstr = ""
for i=0 to (Len(str)/4)-2
Hxstr = Hxstr & chr("&H" & mid(str,4*i+3,2)) & chr("&H" & mid(str,4*i+1,2))
next
Hxstr = trim(Hxstr)
ConvertSN = Hxstr
end function
------------------------------------------
Here is my vbs code to read HD serial number. The WMI return only a unintelligible byte value. So I've written a conversion function.
----------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
str = ""
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMedia")
For Each objItem In colItems
str = objItem.SerialNumber & vbCrlf & vbCrlf
msgbox( "Serial Number : " & ConvertSN(Str))
next
Function ConvertSN(Str)
DIM Hxstr
DIM i
Hxstr = ""
for i=0 to (Len(str)/4)-2
Hxstr = Hxstr & chr("&H" & mid(str,4*i+3,2)) & chr("&H" & mid(str,4*i+1,2))
next
Hxstr = trim(Hxstr)
ConvertSN = Hxstr
end function
------------------------------------------