0

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

prakash
  • 58,901
  • 25
  • 93
  • 115

2 Answers2

1

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
  • 55,577
  • 12
  • 114
  • 149
0

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

computinglife
  • 4,321
  • 1
  • 21
  • 18