Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA"
(ByVal nDrive As String) As Int32
Dim s As String
Dim drivers() As String = Directory.GetLogicalDrives
For Each s In drivers
If GetDriveType(s) = 5 Then
Console.WriteLine("drive letter {0} is a CDROM", s)
End If
Next
FWIW, stick with iboutchkine's suggestion, or some version of that anyway. This blog (http://blogs.vbcity.com/drydo/) shows that it is faster than the one I posted :)
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA"
(ByVal nDrive As String) As Int32
Dim s As String
Dim drivers() As String = Directory.GetLogicalDrives
For Each s In drivers
If GetDriveType(s) = 5 Then
Console.WriteLine("drive letter {0} is a CDROM", s)
End If
Next