[2.0] Enumerating shared folders on a LAN
Hi there,
I can check the shares on my network by issuing this command at the command prompt:
Is there any way in C# I can traverse through all computers connected to my network (By using their IP) and list all shared folders for each one?
I am looking for the fastest way because we have more than 600 PCs to go through.
Thanks :)
Re: [2.0] Enumerating shared folders on a LAN
Well, you could give it the range of the IP Address, then check to see if on the given IP if you can get a string[] of folders (which are shared).
so maybe this may work (untested)
Code:
string hostName = Dns.GetHostName();
IPHostEntry ipE = Dns. GetHostByName(hostName);
IPAddress[] IpA = ipE.AddressList;
for (int i = 0; i < IpA.Length; i++)
{
string[] Directory.GetDirectories(IpA.ToString());
}