WMI in regards to physical drives

VRspace4

Newcomer
Joined
Dec 15, 2003
Messages
2
[C#] WMI in regards to physical drives

*Windows Management Instrumentation

I'm interested in retreiving information about my removable discs from the Win32_LogicalDisk and Win32_DiskDrive classes, in which the values from both classes are combined together for each disc. But the problem is, these two classes don't read the drives in the same order. For instance, Win32_LogicalDisk class reads basically all drives but Win32_DiskDrive class skips CD-ROM drives, so I can't program a basic loop where I can assume that each set of values, in that order given, are for that specific drive, say F: .

What's the best way to tackle this? Thanks in advance. :)
 
Last edited:
well there's Win32_PhysicalMedia , whcih represents any storage device ( cd rom , floppy , HD etc... )
there's Win32_CDROMDrive which represents CD-ROM drives.
Win32_DiskDrive which represents your hard drives.
i guess if you want all of them maybe Win32_PhysicalMedia would be the best to try ( otherwise you would have to use the others seperatly for each type of drive ).
 
PhysicalMedia doesn't have the information my project requires.

Let me try to clarify my previous post from above.

Win32_LogicalDisk sees the drives names as: "C:", "D:", "E:", "F:"
In my computer, "D:", and "E:" are both CD-ROM drives

Win32_DiskDrive as: "\\\\.\\Physical0", "\\\\.\\Physical1"
Physical0 in DiskDrive = C: in LogicalDisk
** skips the two CD-ROM drives
Physical1 in DiskDrive = F: in LogicalDisk

How do I code the program so that it knows that Physical0 in DiskDrive is C: in LogicalDisk, and Physical1 in DiskDrive is F: in LogicalDisk. Only knowing allows me to combine the information from both class for the specifc drive.

This program will be distributed to other computers, so not all drive setups are the same, unfortunately. :(
 
Back
Top