windowsnetwork-programmingc#-2.0labeldrives

Network Drive label


I'm trying to get the label of some network resources mapped as drives. When I use DriveInfo.GetDrives(), local volumes have the VolumeLabel filled parameter as expected, but in network drives it is an empty string. How can I get those labels?


Solution

  • You can use WMI for this - not sure of the exact query (it's been a while), but here's an example of how to get network drive free space:

    http://en.csharp-online.net/Network_Drive_Free_Space

    I think replacing 'name' with 'VolumeName' in that example will give you what you need.

    WMI reference here just in case:

    http://msdn.microsoft.com/en-us/library/aa394173(VS.85).aspx