Rob Munsch et al

This should resolve how do I find all the netbios PC's and usernames.

Please feel free to use this with absolutely NO WARRANTY
NO SUITABILITY IMPLIED

MY LIABILITY IS LIMITED TO WHAT YOU PAID FOR THIS!!

Lines are wrapped

Cut and paste between the marks


# CUT AND PASTE FROM HERE
perl -MCPAN -e 'install Net::Netmask'
perl -MCPAN -e 'install Net::NBName'

cat >nodescan.pl <<EOF
#!/usr/bin/perl
# Please feel free to use this with absolutely
# NO WARRANTY NO SUITABILITY
# IMPLIED

# MY LIABILITY IS LIMITED TO WHAT YOU PAID FOR THIS!!


# SETUP: perl -MCPAN -e 'install Net::Netmask'
# SETUP: perl -MCPAN -e 'install Net::NBName'
# EXAMPLE: "nodescan.pl 192.168.0.0/24" >tosomefilename
# NOTES: builds BackupPC hosts records from the network prints to screen by
default
# NOTES: if logged in user cannot be found they are flagged with
# "FIXME_PLEASE"
#    print "               or GROUP/MACHNAME                       \n";
#    print "NOTE:   MAC ADDR of 00-00-00-00-00-00 \n is probably the
server\n";
    use Net::NBName;
    use Net::Netmask;

    \$backuppc_admin = "ADMINFORBACKUPPC";  # <==WHO IS THE ADMIN
    \$flagged = "FIXME_PLEASE";  # FLAG THE ONES NOT SIGNED ON
    \$dhcp = "0";    # NOT using DHCP
    \$mask = shift or die "expected: <subnet>\n";
    \$nb = Net::NBName->new;
    \$subnet = Net::Netmask->new2(\$mask);
    for \$ip (\$subnet->enumerate) {
        # print "\$ip ";
        \$ns = \$nb->node_status(\$ip);
        if (\$ns) {
            for my \$rr (\$ns->names) {
                if (\$rr->suffix == 0 && \$rr->G eq "GROUP") {
                    \$domain = \$rr->name;
                }
                if (\$rr->suffix == 3 && \$rr->G eq "UNIQUE") {
                    \$user = \$rr->name;
                }
                if (\$rr->suffix == 0 && \$rr->G eq "UNIQUE") {
                    \$machine = \$rr->name unless \$rr->name =~ /^IS~/;
               }
                \$mac_address = \$ns->mac_address;
            }

            \$backuppc_admin = lc("\$backuppc_admin");
            \$machine = lc("\$machine");
            \$user = lc("\$user");
         if ("\$user" eq "\$machine") {
             print
"\$machine\t\$dhcp\t\$backuppc_admin\t\$flagged\t#\$ip\n";
            } else {
                   print
"\$machine\t\$dhcp\t\$user\t\$backuppc_admin\t#\$ip\n";
          }
        # print "\n";
       }
}
EOF
perl nodescan.pl 192.168.1.0/24
# CUT AND PASTE TO HERE

Hope that this helps!!!

Nice name is it Irish?

J Barfknecht  Thedocva at remove some of this juno.com


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
BackupPC-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Reply via email to