Get CD Or DVD Drive Information Using WMI And C#
This snippet shows you how to get information about all CD / DVD drives on your machine using WMI and C#. To run the code you need to add reference to System.Management.
ManagementObjectSearcher mgmtObjects = new ManagementObjectSearcher("Select * from Win32_CDROMDrive");foreach (var item in mgmtObjects.Get()){ Console.WriteLine("Drive Letter - \t" + item["Drive"]); Console.WriteLine("Name - \t" + item["Name"]);}
This code snippet will print out the letter and the name of all CD or DVD drives on a machine. Here is the output on my PC.








I have been using my PC for4 months and I have found that windows does indeed suck.