Can you show sample code for reading a drive label or volume name in .NET? I get the sense this requires WMI, but I am loathe to ‘drop-down’ into WMI because it is like dropping down into a string-based SQL query in the sense that certain objects may not exist on certain versions of OSes or the user may not have the right to query certain data. I will be happy to be convinced that I’m wrong about WMI …
Share
No WMI required. The following will get all volume labels: