ajmac-b
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.
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.
Have you tried WMI?
ASKER
I haven't...can you point me in the right direction?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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("S ELECT * FROM Win32_Share")
lst2.Clear
For Each objitem In colItems
lst2.AddItem "Name: " & objitem.Name & vbTab & objitem.Path
Next
End Function
Function Shares(computerName As String)
strComputer = computerName
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("S
lst2.Clear
For Each objitem In colItems
lst2.AddItem "Name: " & objitem.Name & vbTab & objitem.Path
Next
End Function