
#This is a test change
#!/bin/bash
#iLO Password Updater script

#set -x

function iLO-password-updater()
{

#Build xml config file for ILO
cat << ENDILO > /tmp/ilo.pass 
<!--         RIBCL Sample Script for HP Lights-Out Products          -->
<!--Copyright (c) 2003,2008 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 devices:                                -->
<!--                 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.26 or greater with this script    -->

<!--        This script was written for iLO 2 firmware version 1.30. -->
<!--        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="secretcred"/>
    </MOD_USER>
  </USER_INFO>
  </LOGIN>
</RIBCL>

ENDILO

#Apply new password to the iLO card
hponcfg -f /tmp/ilo.pass

echo "iLO password changed on $(hostname)"
}

##########################################################################################
##		Control logic for the script						##
##########################################################################################

main()
{
echo -e "iLO password changer initiated on $(hostname) at $(date)\n"

iLO-password-updater
}

main