1. Scripts
File Structure
The file structure is as follow:
C:\iLO-Script
          \Template
          \Final
iLO-Script contains scripts and configuration files.
Template contains the file which will be used by the script when generating all configuration files.
Final contains all files with final results for being performed on each server.
Password.pl
Script:
# Written by       Daniel Paessens (HP - TSG - EUWS)
# E-mail:        daniel.paessens@hp.com
#
# Filename:        Password.pl
# Creation Date:  08/03/2007
# Modification Date: 19/03/2007
# Version:          0.2

# use strict;
use Text::Template;
use FileHandle; # this module allows you to use object-oriented
                # syntax for file functions

#
# Prepare Working envirnoment (Variables)
#
my $ini_file= "data.ini";
my $fh;
$fh = new FileHandle $ini_file || die "can't open $ini_file";
#go thru the ini file processing one line at a time.
while ($_ = $fh->getline){
    chomp;
    #skip lines with no letters
    unless (/\w/) {next}
    #skip comments
    next if (/#/);
    #split the line into the variable name and its value
    my ($name, $value) = split (/ = /);
    $$name = ($value);
    }

# @@ -9,8 +31,10 @@
our $minupper;
our $minspecial;
our $distribute;
my $index;
my $password;
my $templatedir =$workdir . "\\Template";
my $finaldir    =$workdir . "\\Final";
my $zone =$workdir . "\\zone.txt";
my $overview =$workdir . "\\result.txt";
my $servers   =$workdir . "\\serverlist.txt";
my $job         =$workdir . "\\job.bat";
if ($length eq "" ) { $length = 12 ;};
if ($minnum eq "" ) { $minnum = 2 ;};
if ($minlower eq "" ) { $minlower = 2 ;};
if ($minupper eq "" ) { $minupper = 2 ;};
if ($minspecial eq "" ) { $minspecial = 2 ;};
# @@ -19,10 +43,67 @@

open(OVER,">$overview") || die ("Could not open $overview");
open(ZONE, $zone) || die ("Could not open $zone");

print OVER "Creation of Passwords\n";
print OVER "---------------------\n";

foreach $line (<ZONE>) {
     chomp($line);
     my $psw =  mkpasswd(
                   -length     => $length,
                   -minnum     => $minnum,
                   -minlower   => $minlower,   # minlower is increased if necessary
                   -minupper   => $minupper,
                   -minspecial => $minspecial,
                   -distribute => $distribute,);
     my $tempfile = $templatedir . "\\Change_Password.xml";
     my $outputfile = $finaldir . "\\Change_Password" . $line .".xml";
     open(N, ">$outputfile");
     my $template = Text::Template->new(SOURCE => $tempfile);
     my %vars = (psw => $psw);
     my $result = $template->fill_in(HASH => \%vars);
     if (defined $result) { print N $result;};
     print OVER "Zone $line\t\t$psw\n";
}
close(ZONE);
close(OVER);

open(SRV, $servers) || die ("Could not open $zone");
open(JOB, ">$job") || die ("Could not open $zone");
@lines = <SRV>;
close(SRV);
print JOB "\@echo off\n";
foreach (@lines) {
     @info = split();
     $srvname = $info[0];
     $zonename = $info[1];
     $job = "xcopy /y " . $finaldir . "\\Change_Password" . $zonename .".xml \\\\" . $srvname .
"\\C\$\\Config\\iLO\\Change_Password.xml\n";
     print JOB $job;
     $job3 = "xcopy /y " . $workdir . "\\Change_Password.bat \\\\" . $srvname . "\\C\$\\Config\\iLO\\Change_Password.bat\n";
     print JOB $job3;
     $job2 = "psexec \\\\" . $srvname . " -w C:\\Config\\iLO\\ C:\\Config\\iLO\\Change_Password.bat\n";
     print JOB $job2;
}

exit;

sub mkpasswd {
     my $password;
     my $UPPER = "ABCDFGHIJKLMNOPQRSTVWXYZ";
     my $LOWER = "abcdefghijklmnopqrstuvwxyz";
     my $DIGIT = "0123456789";
     my $SPECIAL = "?,;.:/!?%*$+)?]@?#&";
     my $index;
     my $random_choice;
     my @pass;
     my @newpass;

     for ($index=0; $index<$minupper; $index++) {
          $password .= substr($UPPER,int(rand(length($UPPER))),1);
          }

     for ($index=0; $index<$minlower; $index++) {
          $password .= substr($LOWER,int(rand(length($LOWER))),1);
          }
     for ($index=0; $index<$minnum; $index++) {
          $password .= substr($DIGIT,int(rand(length($DIGIT))),1);
          }
     for ($index=0; $index<$minspecial; $index++) {
          $password .= substr($SPECIAL,int(rand(length($SPECIAL))),1);
          }

     while (length($password) <  $length) {
     $random_choice=int(rand(4));
     if ($random_choice eq 0) {
          $password .= substr($SPECIAL,int(rand(length($SPECIAL))),1);
          }
     if ($random_choice eq 1) {
          $password .= substr($DIGIT,int(rand(length($DIGIT))),1);
          }
     if ($random_choice eq 2) {
          $password .= substr($LOWER,int(rand(length($LOWER))),1);
          }
        if ($random_choice eq 3) {
          $password .= substr($UPPER,int(rand(length($UPPER))),1);
          }
     }

     # randomize password letters
     @pass = split(//, $password);
     while (@pass) {
          push(@newpass, splice(@pass, rand @pass, 1));
     }
     $password="";
     foreach (@newpass) {
          $password .= "$_";
     }
return $password;
}
Change_Password.xml
Script:
<!--         RIBCL Sample Script for HP Lights-Out Products          -->
<!--   Copyright (c) 2003 Hewlett-Packard Development Company, L.P.  -->
<!-- Description:  This is a sample XML script to change a user's    -->
<!--               password in the database of local users on        -->
<!--               following devides:                                -->
<!--                 Integrated Lights-Out 2 (iLO 2)                 -->
<!--                 Integrated Lights-Out (iLO)                     -->
<!--                 Remote Insight Lights-Out Edition II (RILOE II) -->
<!-- NOTE:  You will need to replace the values inside the quote     -->
<!--        marks with values that are appropriate for your          -->
<!--        environment.                                             -->
<!--        Use CPQLOCFG.EXE ver 2.25 or greater with this script    -->
<!--        This script was written for iLO 2 firmware version 1.00. -->
<!--        release.                                                 -->
<!--        See "HP Integrated Lights-Out Management Processor       -->
<!--        Scripting and Command Line Resource Guide" for more      -->
<!--        information on scripting and the syntax of the RIBCL     -->
<!--        XML.                                                     -->
<!--        Firmware support infomation for this script:             -->
<!--            iLO 2 - All versions.                                -->
<!--              iLO - All versions.                                -->
<!--         RILOE II - All versions.                                -->

<RIBCL VERSION="2.0">
  <LOGIN USER_LOGIN="adminname" PASSWORD="password">
  <USER_INFO MODE="write">
    <MOD_USER USER_LOGIN="Administrator">
      <PASSWORD value="{$psw}"/>
    </MOD_USER>
  </USER_INFO>
  </LOGIN>
</RIBCL>
Password.bat
Script:
@echo off
REM Written by:        Daniel Paessens - HP
REM Email:             daniel.paessens@hp.com
REM Filename:          Password.bat
Rem Purpose:           Launch the password changes on each ilo interface
REM Creation Date:     19/03/2007
REM Modification Date: 19/03/2007

password.exe
job.bat > iLO-Config.log
Change_Password.bat
Script:
@echo off
REM Written by:        Daniel Paessens - HP
REM Email:             daniel.paessens@hp.com
REM Filename:          Change_Password.bat
Rem Purpose:           Launch the password changes on each ilo interface
REM Creation Date:     19/03/2007
REM Modification Date: 19/03/2007

echo %COMPUTERNAME%
echo %DATE% %TIME%
C:\Config\iLO\hponcfg.exe /f C:\Config\iLO\Change_Password.xml