BMC BladeLogic - NSH script to change server description or property value of servers - setPropertyValueByName - blcli
APPLIES TO : BMC Server Automation 8.8
GOAL : This document explains how to change the description of a list of servers using blcli command without login to Bladelogic console.
SOLUTION : Create a NSH script to execute against the list of servers. Find the NSH script below, Before executing the script we need to set the profile option, role name, and acquire the BBSA credentials.
1. Set Profile Name
blcli_setoption serviceProfileName "Production Domain"
2. Set Role Name
blcli_setoption roleName BLAdmins
3. Acquire credentials
blcred cred -acquire
Production Domain
judi@mycompany.com
<enter the credentials>
4. Update the server list in a file named server_list
5. Create NSH script named description_change.nsh with the below content
#!/app/bmc/bladelogic/appserver/NSH/bin/nsh
>fail
>pass
for ServerName in `cat server_list` ; do
RESULT=`blcli -t BLSSO -v "Production Domain" -r BLAdmins Server setPropertyValueByName $ServerName DESCRIPTION "Unix Servers"`
if [ $? -ne 0 ] ; then
echo "$ServerName - $RESULT" >> fail
else
echo echo "$ServerName - $RESULT" >> pass
fi
done
6. Log Files:
Pass - Contains the list of servers description changed successfully.
Fail - Contains the list of servers description NOT changed successfully.
~Judi~
APPLIES TO : BMC Server Automation 8.8
GOAL : This document explains how to change the description of a list of servers using blcli command without login to Bladelogic console.
SOLUTION : Create a NSH script to execute against the list of servers. Find the NSH script below, Before executing the script we need to set the profile option, role name, and acquire the BBSA credentials.
1. Set Profile Name
blcli_setoption serviceProfileName "Production Domain"
2. Set Role Name
blcli_setoption roleName BLAdmins
3. Acquire credentials
blcred cred -acquire
Production Domain
judi@mycompany.com
<enter the credentials>
4. Update the server list in a file named server_list
5. Create NSH script named description_change.nsh with the below content
#!/app/bmc/bladelogic/appserver/NSH/bin/nsh
>fail
>pass
for ServerName in `cat server_list` ; do
RESULT=`blcli -t BLSSO -v "Production Domain" -r BLAdmins Server setPropertyValueByName $ServerName DESCRIPTION "Unix Servers"`
if [ $? -ne 0 ] ; then
echo "$ServerName - $RESULT" >> fail
else
echo echo "$ServerName - $RESULT" >> pass
fi
done
6. Log Files:
Pass - Contains the list of servers description changed successfully.
Fail - Contains the list of servers description NOT changed successfully.
~Judi~
No comments:
Post a Comment