Skip to content

Instantly share code, notes, and snippets.

@ksingh7
Last active August 9, 2022 13:51
Show Gist options
  • Save ksingh7/3f1158493ca8bfafc705 to your computer and use it in GitHub Desktop.
Save ksingh7/3f1158493ca8bfafc705 to your computer and use it in GitHub Desktop.
HP ILO user create from CLI
# Script to create admin and administrator user
#!/bin/bash
IPs=`echo 86.50.1.{150..168}`
for ip in $IPs
do
echo Starting $ip
sshpass -p 'ROOTPWD' ssh -o StrictHostKeyChecking=no -l root $ip "create /map1/accounts1 username=Administrator password=ADMINISTRATORPWD name=Administrator group=admin,config,oemhp_rc,oemhp_power,oemhp_vm"
sshpass -p 'ROOTPWD' ssh -o StrictHostKeyChecking=no -l root $ip "create /map1/accounts1 username=admin password=ADMINPASSWORD name=admin group=admin,config,oemhp_rc,oemhp_power,oemhp_vm"
done
# script to reset password
#!/bin/bash
IPs=`echo 86.50.1.{150..167}`
for ip in $IPs
do
echo Starting $ip
sshpass -p 'ROOTPWD' ssh -o StrictHostKeyChecking=no -l root $ip "set /map1/accounts1/Administrator password=NEWADMINISTRATORPWD"
sshpass -p 'ROOTPWD' ssh -o StrictHostKeyChecking=no -l root $ip "set /map1/accounts1/admin password=NEWADMINPASSWORD"
sshpass -p 'ROOTPWD' ssh -o StrictHostKeyChecking=no -l root $ip "set /map1/accounts1/root password=NEWROOTPASSWORD"
done
@Astiliano
Copy link

Was looking for the ilo commands, came across your git
Here's what I ended up putting together with it

function addilouser() {
echo "---- Existing credentials to log into host -----"
read -p "ILO ssh user: " loginusr
echo -n "ILO ssh password: "
read -s loginpw

echo -e "\n---- Create new user details-----"
read -p "Add User: " newusr
echo -n "Password for $newusr:  "
read -s newpw

for ip in $@
do
    echo Starting $ip
	sshpass -p$loginpw ssh -o StrictHostKeyChecking=no -l $loginusr $ip "set /map1/config1 oemhp_minpwdlen=5"
    sshpass -p$loginpw ssh -o StrictHostKeyChecking=no -l $loginusr $ip "create /map1/accounts1 username=$newusr password=$newpw name=$newusr group=admin,config,oemhp_rc,oemhp_power,oemhp_vm"

done
}

#Usage
addilouser US-SERVER{01..25}-ilo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment