Link to home
Start Free TrialLog in
Avatar of ajmac-b
ajmac-bFlag for Australia

asked on

Enumerating share resources on a remote computer

I am looking for a way to find the share paths on a remote machine. This information is visible in the Compmgmt.msc snap in under shares, but I need to extract it programatically in VB6. The path information is retrievable if the remote registry can be read, but often security settings prevent this. Using NET VIEW \\<ComputerName> gives the sharenames, but not the internal pathway associated with them.
The end objective is to find a way to determine whether a share exists on a remote machine which references a specific path on that machine - ie Is there a share on machine ABC which references folder C:\XYZ.
Avatar of aikimark
aikimark
Flag of United States of America image

Have you tried WMI?
Avatar of ajmac-b

ASKER

I haven't...can you point me in the right direction?
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ajmac-b

ASKER

With a bit of reading and playing, I found a solution that works for my purposes:

Function Shares(computerName As String)

strComputer = computerName
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Share")
lst2.Clear
For Each objitem In colItems
 lst2.AddItem "Name: " & objitem.Name & vbTab & objitem.Path
Next
End Function