Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Mounted Drives in c#

Tags:

c#

DriveInfo.GetDrives() will enumerate all volumes mounted with a drive letter, but is there any way (without p/invoking Win32) to enumerate raw volumes, or to see volumes that may be mounted in a folder and not a drive letter?

like image 405
Josh Baker Avatar asked Nov 21 '12 11:11

Josh Baker


Video Answer


1 Answers

Yes, using WMI (Windows Management Interface)

The Win32_DiskDrive class contains information on physical hard drives, which can then be further examined to get a list of partitions.

There's also a decent tutorial on using WMI from C# and .Net

like image 197
PhonicUK Avatar answered Oct 24 '22 19:10

PhonicUK