Hi,
I use this script to join machines to domain. This is code is meant for
a single machine. How would I modify it in a way I would be able to put
a bunch of machines in a text file & join them all to the domain?

Thanx,


my $domain = "my domain";
my $dom_admin = "admin";
my $dom_pw = "xxxx";
my @ws;
my $ws_admin ;
my $ws_pw = "xxxx";

open (MACH, "<ws.txt") or die ("Cant open: $!"); open (ERR, ">err.out")
or die ("Cant open: $!"); 
@ws=<MACH>;
close (MACH);
print @ws;
{
         $ws_admin = "admin";
      system("NETDOM JOIN @ws /Domain:$domain /UserD:$dom_admin
        /PasswordD:$dom_pw /UserO:$ws_admin /PasswordO:$ws_pw
/reboot:5");

      my $err = $? >> 8; 
        if ($err) { print ERR "Machine: @ws failed on join\n" }
        else {print ERR "Machine: @ws joined successfully\n"}  

        sleep 5;
}
close (MACH);


R o n e n   K f i r
System Administrator
CIT div. Tel Aviv University
Israel
Tel: 972-3-6407416
Fax: 972-3-6405158
cellular: 972-55-405910
E-mail: [EMAIL PROTECTED]
 
 


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

Reply via email to