Information générale
Catégorie:
Fonctions Windows API
Titre:
Hard Disk Serial Number
Versions des environnements
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement