Listing 1: BulkChangePw.pl use Win32::NetAdmin; use strict; BEGIN COMMENT LINE # Declare the script’s variables. END COMMENT LINE my($Node, $AcctName, $OldPw, $NewPw, $InputFile, $OutputFile, $line, @INFILE_array) = @_; BEGIN COMMENT LINE # Configure the input and output file locations. END COMMENT LINE $InputFile = "C:\\Scripts\\inputfile.csv"; $OutputFile = "C:\\Scripts\\logfile.csv"; BEGIN COMMENT LINE #### No configuration is needed beyond this point. #### END COMMENT LINE BEGIN CALLOUT A BEGIN COMMENT LINE # Open the input file and populate an array with the server, account, and password information. END COMMENT LINE open(INFILE,"<$InputFile") || die "open0: $!"; BEGIN COMMENT LINE # Populate the array with all the lines in the input text file. END COMMENT LINE @INFILE_array=; close(INFILE) || die "close0: $!"; END CALLOUT A BEGIN CALLOUT B BEGIN COMMENT LINE # For each of the lines in the array, attempt a password change. END COMMENT LINE foreach $line (@INFILE_array) { chomp($line); $line =~ /\S/ or next; ($Node,$AcctName,$OldPw,$NewPw) = split (/,/ , $line); END CALLOUT B BEGIN CALLOUT C BEGIN COMMENT LINE # Log the results. END COMMENT LINE if( Win32::NetAdmin::UserChangePassword("\\\\$Node", "$AcctName", "$OldPw","$NewPw")){ print "Password has been changed on $Node.\n"; `echo $Node,Success>>"$OutputFile"`; }else{ print "Password could not be changed on $Node.\n"; `echo $Node,Failure>>"$OutputFile"`; } } print "PW change run complete!"; END CALLOUT C