Something like this should work:

use Win32::AdminMisc;
$domain = "MYDOMAIN";
$pdc = Win32::AdminMisc::GetPDC($domain);
@names = qw(guest administrator);
$oldpassword = "foo";
$newpassword = "bar";

Win32::AdminMisc::GetMachines($pdc,UF_WORKSTATION_TRUST_ACCOUNT|UF_SERVER_TR
UST_ACCOUNT,\@machines;
foreach(@machines){
   foreach $name(@names){
      $_ =~ s/\$$//;  #get rid of the trailing $
      print "\\\\$_\\$name";
 
if(Win32::AdminMisc::UserChangePassword("\\\\$_",$name,$oldpassword,$newpass
word)){
         print "password changed\n";
      }else{
         print "error changing password\n";
      }
   }
}

-----Original Message-----
From: Sherman Cerezo [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 15, 2002 4:58 PM
To: '[EMAIL PROTECTED]'
Subject: Change Local Password


Hi all,

It's embarassing to ask again but does anyone has a script 
that can change the local passwords on a mixed farm of NT and 2000 pro?
Thanks

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


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to