Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hard Disk Serial Number
Message
From
10/07/2009 23:20:46
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Hard Disk Serial Number
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01411564
Message ID:
01411564
Views:
273
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
Map
View

Click here to load this message in the networking platform