General information
Category:
Windows API functions
Title:
Hard Disk Serial Number
I want to retrieve the permanent hard disk serial number -- NOT the changeable volume number returned by GetVolumeInformation -- for my laptop's fixed disk. However, the following code returns \\.\PHYSICALDRIVE0 for the Tag and .NULL. for the SerialNumber. --
loWMI = GETOBJECT("winmgmts:")
loPhyDrives = loWMI.ExecQuery('Select * from Win32_PhysicalMedia')
FOR EACH loPhyDrive IN loPhyDrives
? loPhyDrive.Tag, loPhyDrive.SerialNumber
ENDFOR
************************
And the following code returns 1 for the Count and .NULL. for all of the hard disk properties except Tag --
oWMI = GETOBJECT("winmgmts:")
oDisks = oWMI.ExecQuery('Select * from Win32_PhysicalMedia')
? "Count", oDisks.Count
FOR EACH oDisk IN oDisks
FOR EACH loProperty IN oDisk.Properties_
lcProp = "odisk." + loProperty.Name
? loProperty.Name, &lcProp
ENDFOR
ENDFOR
*************************
Is there something better I can try?
TIA,
-mark
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only