Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hard Disk Serial Number
Message
De
10/07/2009 23:20:46
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Hard Disk Serial Number
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01411564
Message ID:
01411564
Vues:
271
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
Fil
Voir

Click here to load this message in the networking platform