Josh Baker
Josh Baker

Reputation: 71

Get Mounted Drives in 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?

Upvotes: 7

Views: 2829

Answers (1)

PhonicUK
PhonicUK

Reputation: 13864

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

Upvotes: 6

Related Questions