Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve UNC Path to mapped drives

Status
Not open for further replies.

wsnider

Programmer
Apr 29, 2002
15
0
0
US
How can I get the complete UNC path string to my mapped drives, like what is returned by "Net Use".
 
Please allow me to answer my own question. You can set a reference to the old COM FileSystemObject and use as follows.

Function GetUNCPath(ByVal strDrvLetter As String) As String
Dim fso As New Scripting.FileSystemObject()
Dim drv As Scripting.Drive = fso.GetDrive(strDrvLetter ":")
If drv.DriveType = Scripting.DriveTypeConst.Remote Then
Return drv.ShareName
Else
Return drv.Path
End If
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top