If you install the Lanman module as Chuck suggested, this will do the trick.
Enlarge your Command prompt window beyond 80 columns to make 
display readable.

And yes, Dave Roth's books are really good places to show you how to 
apply Perl to Win32 admin tasks. My advice is, get both. 
Highly recommended. 



# NetGroupEnum($server, \@groups)
# retrieves all global groups on server \\$computer 
# Note : Output is optimised for more-than-80 columns 
#        command prompt window...
# Syntax : PERL THISCRIPT.PL \\DOMAINCONTROLLERNAME
#        or    PERL THISCRIPT.PL DOMAINCONTROLLERNAME


use Win32::Lanman ;

$computer = "$ARGV[0]" ;

$computer = substr($computer,2,) if (substr($computer,0,2) eq "\\\\") ;
#print "------------[$computer]------------\n" ;


if(!Win32::Lanman::NetGroupEnum("\\\\$computer", \@groups)) { 
        print "Sorry, something went wrong; error: "; 
        # get the error code 
        print Win32::Lanman::GetLastError();
        print " : $^E\n" ;
        exit 1; 
        }
        
        
foreach $group (@groups) { 
        print "${$group}{'name'}", "." x (30 - (length(${$group}{'name'}))),

        "${$group}{'comment'}", "." x (100 -
(length(${$group}{'comment'}))), 
        "${$group}{'group_id'}\t${$group}{'attributes'}\n"; 
        } 



_____________________________________________
Bruno Bellenger
Sr. Network/Systems Administrator 



        -----Original Message-----
        From:   Sola, Nicolas R [SMTP:[EMAIL PROTECTED]]
        Sent:   Tuesday, March 27, 2001 7:40 PM
        To:     '[EMAIL PROTECTED]'
        Subject:        Win32::NetAdmin
        Importance:     High

        > I'm an NT Admin in desperate need for automating some of my
process.
        > After evaluating my options, I choose Perl as my tool for
scripting.
        > Recently I took a 
        > class, so that makes me a beginner.  Unfortunately I have a task
that
        > exceed my expertise.  I need to get Global Groups names and the
comment
        > field from our 
        > PDC.  I think that the Win32::NetAdmin module can accomplish this.
Could
        > someone point me into how to accomplish this?
        > 
        > Your assistance will be greatly appreciated,
        > 
        > Nick Sola
        > The Boeing Company
        > International Space Station
        > NT Systems Administrator
        > [EMAIL PROTECTED]
        _______________________________________________
        Perl-Win32-Admin mailing list
        [EMAIL PROTECTED]
        http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to