2

We are running our application over the network from a shared drive.

Is there a way in .Net to get the computer name of the mapped drive?

That's all I need! Thank you!

ErocM
  • 4,505
  • 24
  • 94
  • 161
  • possible duplicate of [How to programmatically discover mapped network drives on system and their server names?](http://stackoverflow.com/questions/1088752/how-to-programmatically-discover-mapped-network-drives-on-system-and-their-server) – Etienne de Martel May 08 '11 at 03:20
  • Unless that gives me the UNC I don't see how it is a duplicate? Correct me if I am wrong, but I couldn't get a UNC out of it. – ErocM May 08 '11 at 03:35

1 Answers1

3

WMI will give you this information. This is a great example, and here are a few more examples.

Community
  • 1
  • 1
Bobby D
  • 2,129
  • 14
  • 21
  • I've got it to work on my local drive using the code. I'm new at this so bear with me but how do I use it to get a remote drive unc? – ErocM May 08 '11 at 03:34
  • You could pull the `ProviderName` for the drive and parse out the remote system name. Check the reference for the [Win32_LogicalDisk](http://msdn.microsoft.com/en-us/library/aa394173.aspx) class for information on what data you can retrieve about a drive. – Bobby D May 08 '11 at 03:42