http://qs321.pair.com?node_id=238770


in reply to Viewing network shares

Instead of hardcoding the computer names in the script, why not read in the lmhosts file?

Added from here down.

I looked at lmhosts.sam and found the following example:

102.54.94.97 rhino #PRE #DOM:networking #net group's DC 102.54.94.102 "appname \0x14" #special app serv +er 102.54.94.123 popular #PRE #source server 102.54.94.117 localsrv #PRE #needed for the i +nclude #BEGIN_ALTERNATE #INCLUDE \\localsrv\public\lmhosts #INCLUDE \\rhino\public\lmhosts #END_ALTERNATE

It would be easy to extract the names of the computers (the ones in other domains too) and also to read in the names from include files on other systems.

Replies are listed 'Best First'.
Re: Re: Viewing network shares
by Hyler (Sexton) on Feb 26, 2003 at 16:00 UTC

    As I wrote in the initial description, I did this to check a group of computers, not all "visible" computers on the network.

    I wrote this little thing to save me from manually having to browse the computers for shares. Learning about the topic and writing it took longer than it would have taken to manually check the computers. But next time I want to check some computers it's just a matter of seconds to alter and run it. The ARGV bit also makes it possible to simply run

    sharescheck.pl computer1 computer7 server_A laptopBOB
    Does anyone really use the LMHOSTS file? Maybe for small internal networks with few (Windows) computers, but otherwise I think it's better managed by a Domain Controller (and with DHCP/WINS). It would be better to ask the "Windows network" about its resources than to check a local file whose validity you can't be sure of.