Differentiating between a CD drive and a DVD drive

P

Pete Davis

I'm trying to figure out how to distinguish a CD drive from a DVD drive. I
thought it would be as simple as using WMI, but the properties that would
distinguish between the 2 don't seem to exist (at least on my system).

Win32_LogicalDisk makes no distinction.

I thought I could with Win32_CDROMDrive, by using the MaxMediaSize, but that
property doesn't exist.

I then downloaded the MS WMI Tools and used the WMI browser. I can't seem to
find anything that distinguishes the two.

I need to be able to do this without any media in the drives, so checking
for free space won't cut it.

Anyone have any ideas?

Pete
 
N

Nicholas Paldino [.NET/C# MVP]

Pete,

If you have the Win32_DiskDrive instance, you should be able to get the
Win32_PhysicalMedia instance for it, which represents the physical media
backing the drive (through the Win32_DiskDrivePhysicalMedia mapping).

Once you have that Win32_PhysicalMedia instance, you can look at the
MediaType property to get what kind of drive it is (it will differentiate
between CD, CDRW, DVD, DVDRW, etc, etc).

Hope this helps.
 
P

Pete Davis

Unfortunately, Win32_PhysicalMedia only gives me one property for all 6
PhysicalDrives that I have: Tag. The Tag is: \\.\PHYSICALDRIVE0, ...
\\.\PHYSICALDRIVE5

Additionally, the DiskDrive devices, oddly enough, don't include my DVD Rom
drives. It has my hard drive, the USB Storage device in my printer, and the
4 actual card slots in the USB storage device.

Don't know why the two DVD drives aren't there.

If I start from Wn32_CDROMDrive, I can get that, and Win32_PnPEntity. But
neither of these appear to distinguish between CD and DVD.

The only way I can see to possibly do it is to take the name or caption and
look for DVD in it, but that doesn't seem to be a very reliable way of doing
it.

Pete

Nicholas Paldino said:
Pete,

If you have the Win32_DiskDrive instance, you should be able to get the
Win32_PhysicalMedia instance for it, which represents the physical media
backing the drive (through the Win32_DiskDrivePhysicalMedia mapping).

Once you have that Win32_PhysicalMedia instance, you can look at the
MediaType property to get what kind of drive it is (it will differentiate
between CD, CDRW, DVD, DVDRW, etc, etc).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Pete Davis said:
I'm trying to figure out how to distinguish a CD drive from a DVD drive.
I thought it would be as simple as using WMI, but the properties that
would distinguish between the 2 don't seem to exist (at least on my
system).

Win32_LogicalDisk makes no distinction.

I thought I could with Win32_CDROMDrive, by using the MaxMediaSize, but
that property doesn't exist.

I then downloaded the MS WMI Tools and used the WMI browser. I can't seem
to find anything that distinguishes the two.

I need to be able to do this without any media in the drives, so checking
for free space won't cut it.

Anyone have any ideas?

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top