Enumerating Network Shares

Enumerating network shares

You can use NetShareEnum win32 api.
http://www.pinvoke.net/default.aspx/netapi32/netshareenum.html

Or look at the following project which is .NET Wrapper over it.
http://www.codeproject.com/KB/IP/networkshares.aspx

Enumerate list of network computers and shared folders in a tree view?

WNetOpenEnum will give you all the computers on the network

The WNetOpenEnum function starts an enumeration of network resources
or existing connections. You can continue the enumeration by calling
the WNetEnumResource function.

NetShareEnum will you all shares on a machine.

Retrieves information about each shared resource on a server.

You can use the combination of both to filter out what you don't want

Enumerate Windows network shares and all custom permissions on or within

I know it isnt scripting, but have you tried ShareEnum? http://technet.microsoft.com/en-us/sysinternals/bb897442.aspx and then export it out? You can also compare to older runs. I don't think there is a cmd line interface (which sucks), but it will get you the info you need

Why network shares enumeration is so slow on Windows?

As for why it is so slow, if a host is unavailable or not responding for whatever reason (requiring login credentials, for instance), Windows will wait for the timeout limit to be exceeded, for every share known in the network (which can be multiple per host). Windows' default timeouts are insanely long.

Reducing the timeout to something like 50ms (which should never be exceeded in a LAN) might help here, ultimately it depends on the amount of hosts tested.

I cannot help concerning alternatives towards the API, sorry.



Related Topics



Leave a reply



Submit