Returns information about all the CD-ROM drives installed on a computer.

This script was tested using Python 2.2.2-224 for Microsoft Windows, available from ActiveState.

Python
Edit|Remove
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_CDROMDrive")
for objItem in colItems:
    print "Availability: ", objItem.Availability
    z = objItem.Capabilities
    if z is None:
        a = 1
    else:
        for x in z:
            print "Capabilities: ", x
    z = objItem.CapabilityDescriptions
    if z is None:
        a = 1
    else:
        for x in z:
            print "Capability Descriptions: ", x
    print "Caption: ", objItem.Caption
    print "Compression Method: ", objItem.CompressionMethod
    print "Config Manager Error Code: ", objItem.ConfigManagerErrorCode
    print "Config Manager User Config: ", objItem.ConfigManagerUserConfig
    print "Creation Class Name: ", objItem.CreationClassName
    print "Default Block Size: ", objItem.DefaultBlockSize
    print "Description: ", objItem.Description
    print "Device ID: ", objItem.DeviceID
    print "Drive: ", objItem.Drive
    print "Drive Integrity: ", objItem.DriveIntegrity
    print "Error Cleared: ", objItem.ErrorCleared
    print "Error Description: ", objItem.ErrorDescription
    print "Error Methodology: ", objItem.ErrorMethodology
    print "File System Flags: ", objItem.FileSystemFlags
    print "File System Flags Ex: ", objItem.FileSystemFlagsEx
    print "Id: ", objItem.Id
    print "Install Date: ", objItem.InstallDate
    print "Last Error Code: ", objItem.LastErrorCode
    print "Manufacturer: ", objItem.Manufacturer
    print "Max Block Size: ", objItem.MaxBlockSize
    print "Maximum Component Length: ", objItem.MaximumComponentLength
    print "Max Media Size: ", objItem.MaxMediaSize
    print "Media Loaded: ", objItem.MediaLoaded
    print "Media Type: ", objItem.MediaType
    print "Mfr Assigned Revision Level: ", objItem.MfrAssignedRevisionLevel
    print "Min Block Size: ", objItem.MinBlockSize
    print "Name: ", objItem.Name
    print "NeedsCleaning: ", objItem.NeedsCleaning
    print "Number Of Media Supported: ", objItem.NumberOfMediaSupported
    print "PNP Device ID: ", objItem.PNPDeviceID
    z = objItem.PowerManagementCapabilities
    if z is None:
        a = 1
    else:
        for x in z:
            print "Powe rManagement Capabilities: ", x
    print "Power Management Supported: ", objItem.PowerManagementSupported
    print "Revision Level: ", objItem.RevisionLevel
    print "SCSI Bus: ", objItem.SCSIBus
    print "SCSI Logical Unit: ", objItem.SCSILogicalUnit
    print "SCSI Port: ", objItem.SCSIPort
    print "SCSI Target Id: ", objItem.SCSITargetId
    print "Size: ", objItem.Size
    print "Status: ", objItem.Status
    print "Status Info: ", objItem.StatusInfo
    print "System Creation Class Name: ", objItem.SystemCreationClassName
    print "System Name: ", objItem.SystemName
    print "Transfer Rate: ", objItem.TransferRate
    print "Volume Name: ", objItem.VolumeName
    print "Volume Serial Number: ", objItem.VolumeSerialNumber