views:

404

answers:

2

I'm trying to create a deployment tool that will install software based on the hardware found on a system. I'd like the tool to be able to determine if the optical drive is a writer (to determine if burning software sould be installed) or can read DVDs (to determine if a player should be installed). I tried uing the following code

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
For Each objItem in colItems
    Wscript.Echo "MediaType: " & objItem.MediaType
Next

but it always respons with CD-ROM

+1  A: 

You can use WMI to enumerate what Windows knows about a drive; get the Win32_DiskDrive instance from which you should be able to grab the the Win32_PhysicalMedia information for the physical media the drive uses; the MediaType property to get what media it uses (CD, CDRW, DVD, DVDRW, etc, etc).

blowdart
A: 

Platform SDK - IDiscMaster::EnumDiscRecorders (XP / 2003)

DirectX and DirectShow has extensive interfaces to work with DVD

Else enumerate disk drives and try firing a DeviceIonControlCode that supports extarcting the type info.

Good luck