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.

One Response to Get CD Or DVD Drive Information Using WMI And C#
Leave a Reply Cancel reply
Top Posts
- LINQ To SQL Tutorial
- LINQ To SQL Join On Multiple Conditions
- Code Sample: Programmatically Download File Using C#
- Windows 7 Control Panel In Classic Mode
- More Details Emerge On Microsoft Master Certification
- Use SqlConnection With LINQ To SQL
- Free Icons And Images With Visual Studio 2008
- Capture XML In WCF Service
- Dynamic Sort With LINQ
- StyleCop Tutorial
Tags
.Net 2010 ADO.NET ASP.NET Azure Blogging Books Browsers C# Certification Cloud Computing Code Snippets Community Data Services Eclipse Entity Framework Google IDE Java LINQ Mac Microsoft Museum NetBeans Office Oracle REST SharePoint Silverlight SQL Server T-SQL Tips Tools Training Visual Studio Visual Studio 2010 WCF Web Windows Windows 7 Windows Forms Windows Live WMI WPF XAML


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