views:

229

answers:

2

Hello, 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?

+1  A: 

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

Mark B
It works, thank you very much
Gonzalo Quero
+1  A: 

Never use WMI Use net apis.