Kevin,

   Try this piece of code. It returns all servers that are currently
online.
   You'll need Win32::AdminMisc, Win32::NetAdmin and Win32::Lanman.
   You should edit the line "my @Domains" with your own list of NT Domains.
   Oh... BTW, you'll need Admin rights....on all Domains.

#-------------------------------------------
sub Pega_Servers {
   my @Domains = qw/XXXXXX YYYYYY ZZZZZZ AAAAAA/;
   my (%Servidores, %Servers, @Servers, @dcservers, $server, $Domain, $PDC
);
   foreach $Domain (@Domains) {
      $PDC = Win32::AdminMisc::GetPDC($Domain);
      Win32::NetAdmin::GetServers($PDC,$Domain,SV_TYPE_SERVER_NT, \
%Servidores);
      foreach $server (keys %Servidores) {
         $Servers{"$Domain:\\\\".$server} = "$Domain:\\\\$server";
      }
      if(!Win32::Lanman::I_NetGetDCList($PDC, $Domain, [EMAIL PROTECTED])) {
         ReportWarn("*** Nao pude pegar lista de Domain Controllers do
dominio $Domain");
      }
      else {
         foreach $server (@dcservers) {
            $Servers{"$Domain:$server"} = "$Domain:$server";
         }
      }
   }
   foreach $server (sort keys %Servers) {
      push @Servers, "$Servers{$server}";
   }
   return ( join ';',@Servers);
}
#--------------------------------------------------

You call it like this:

   my $Servidores = Pega_Servers();
   my @Servidores = split (/;/,$Servidores);
   foreach $servidor (@Servidores) {
       INSERT YOUR OWN CODE HERE
     }

Hope this helps

Cheers,
/LG
/Luiz George Ramsey Barreiros
Analista Assistente de Informatica
GEPRO NRT 1-RJ/SETAR
Banco do Brasil S.A.



                                                                                       
                            
                                                                                       
                            
                                                                 Para:   [EMAIL 
PROTECTED] 
               [EMAIL PROTECTED]                       cc:                             
                  
               Enviado Por:                                      Assunto:     Newbie 
Help                          
               [EMAIL PROTECTED]                                                       
   
               e.com                                                                   
                            
                                                                                       
                            
                                                                                       
                            
               19-11-2003 14:05 CST                                                    
                            
                                                                                       
                            
                                                                                       
                            



Hi all, I need a script that will go to every server in my Domain and grab
a text file rename it and then move it to central location.
I was thinking of making an Adsi call for OS but that would show all
NT/2000 + boxes not just servers, any idea how I could use Win32 or ADSI to
just return all SERVERS to an array?

Thanks!

Kevin Montes
BJ Services Company


_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs




_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to