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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With