One workaround way to find out a network drive’s remote network name in VB, that’s because I have such a little time to find the proper way for the test case…



Dim cmdParam As String = String.Format(" /c net.exe use {0}: > c:\a.txt", curDriveLetter)


Dim pr As System.Diagnostics.Process = System.Diagnostics.Process.Start("cmd.exe", cmdParam)

While Not pr.HasExited


End While


Dim remoteName As String = ""

If (System.IO.File.Exists("c:\a:txt")) Then

   Dim allStr As String = System.IO.File.ReadAllText("c:\a.txt")



   Dim r As New Text.RegularExpressions.Regex("(?<name>\\\\.*?)\s")

   Dim m As Text.RegularExpressions.Match = r.Match(allStr)

   remoteName = m.Groups("name").Value

End If