How to find all CD/DVD & CD/DVD-RW drives?

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

How can I find all CD/DVD drives on a system? And how can I tell if they are
RW's?

Thanks.
 
Try this

Dim objQuery As ObjectQuery
Dim objSearcher As ManagementObjectSearcher
Dim scope As ManagementScope = New ManagementScope
Dim strComputerName As String = "."
Dim queryCollection As ManagementObjectCollection

scope = New ManagementScope("\\" & strComputerName &
"\root\cimv2")
scope.Connect()
objQuery = New ObjectQuery("Select * From Win32_CDROMDrive")
objSearcher = New ManagementObjectSearcher(scope, objQuery)
queryCollection = objSearcher.Get()
For Each m As ManagementObject In queryCollection
MsgBox(m("Drive") & " " & m("Description"))
Next

Hope this will helps
 
Back
Top