Results 1 to 2 of 2

Thread: [2.0] Enumerating shared folders on a LAN

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    277

    [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:

    Code:
    net view \\ip

    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

  2. #2
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    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());
    }

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width