How about something like:
This will return paths valid for the local system too, but you could exclude those by host name.Code:Option Explicit 'Ref to: Microsoft Shell Controls and Automation. Private Shares As Collection Private Sub EnumerateShares() 'Finds all of the file shares accessible on the network using 'the current credentials of the process. Dim fldNetHood As Shell32.Folder Dim itmHost As Shell32.FolderItem Dim itmShare As Shell32.FolderItem With New Shell32.Shell Set fldNetHood = .NameSpace(ssfNETWORK) End With Set Shares = New Collection For Each itmHost In fldNetHood.Items If itmHost.IsFolder Then For Each itmShare In itmHost.GetFolder.Items If itmShare.IsFileSystem Then Shares.Add itmShare.Path End If Next End If Next End Sub




Reply With Quote