|
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.

Leave a Reply
5350 views, 3 so far
today |
Get Updates By Email
Popular Post
Tag Cloud
Code Snippets
- Get Current Windows User In C#
- Get Width And Height Of Image In C#
- Get Windows Registry Size With WMI And C#
- Reverse Array Elements Using C#
- Convert Hexadecimal To Number In C#
- Get Free Disk Space Using T-SQL
- SQL Server 2008 – Get All Indexes In A Database
- Get Name Of Current Executing Assembly In C#
- Get CD Or DVD Drive Information Using WMI And C#
- Get Last Row From Table Using LINQ To SQL


December 9th, 2009 at 5:20 am
I have been using my PC for4 months and I have found that windows does indeed suck.