Jump to content

detect CD/DVD writer unattended


Recommended Posts

Hi,

I'm looking for a solution to detect if an optical drive with writing capabilities is present during unattended setup.

I thought it might be possible with devcon.exe. But I do not find a usable method. Since we have a lot of different hardware the hwid is not a usable solution.

But some software packages recognize if a drive is writeable so there must be a method for detecting.

Background: I want to install CD Burner XP only on computers which have a CD or DVD writer. So I need to query from command line or vbs.

Regards, Nils.

Link to comment
Share on other sites


I'm not sure how you can tell in Win7. Mine is just installed as a generic CD-ROM, but it still burns properly. No device info could say that specifically, so using HwID might be your only option. However there may be some info in WMI, you'd have to check msinfo32 to see if there is anything in there to say its a burner.

If this is not for Windows 7, let me know, I'll move the topic.

Link to comment
Share on other sites

You can get the infos using WMI fairly easily. See the documentation for the Win32_CDROMDrive WMI class. Here's a quick snippet with the relevant properties included:


strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_CDROMDrive")
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "Win32_CDROMDrive instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "Caption: " & objItem.Caption
If isNull(objItem.Capabilities) Then
Wscript.Echo "Capabilities: "
Else
Wscript.Echo "Capabilities: " & Join(objItem.Capabilities, ",")
End If
If isNull(objItem.CapabilityDescriptions) Then
Wscript.Echo "CapabilityDescriptions: "
Else
Wscript.Echo "CapabilityDescriptions: " & Join(objItem.CapabilityDescriptions, ",")
End If
Wscript.Echo "MediaType: " & objItem.MediaType
Next

Capabilities *should* include 4 if writing is supported.

Hopefully it should be a fairly reliable check. Otherwise you'd have to dig into IMAPI (v2 preferably, most likely using C++) which is a whole lot more fun.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...