I want to get all the computers in my network and all the shared folders in it(Should work in both domain and workgroup). I was able to get all the computers in the network using below code
Dim ipproperties As NetworkInformation.IPGlobalProperties = NetworkInformation.IPGlobalProperties.GetIPGlobalProperties()
Dim domain As String = ipproperties.DomainName
Dim domainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" + domain)
domainEntry.Children.SchemaFilter.Add("computer")
For Each computer As DirectoryEntry In domainEntry.Children
ListBox1.Items.Add(computer.Name)
Next
But now i want to get shared folders of each computer. So i used this code using DirectoryEntry. But it gave error like "The group name could not be found" for a network computer. So what is the reason I am getting error. Or is there any other method to get shared folders of computers which are in my network.(I don't want to use WMI solutions)
You could use WMI's
Win32_Share
: Take a look at the example here (you'll need toWin32_LogicalDisk
withWin32_Share
ManagementObjectSearcher
, as in the example here to specify a different computer.