Using the vcemcli in a script – HP Insight Management-Software User Manual
Page 10
Table 1 Common options (continued)
Description
CLI options
NOTE:
When you are using this option, sequential edits
queued for the same profile might conflict with the changes
being applied. HP recommends that you use blocking
operations when you are performing multiple changes to
a given profile. This approach ensures that the changes
for each edit are applied to the profile before the next
group of changes are initiated. Do not submit multiple
non-blocked commands for a single profile. Later
commands may overwrite the changes made by earlier
commands. For example, do not submit a series of
non-blocked commands to add network connections to a
given profile.
Suppresses output from the VCEMCLI.
–silent
When set, instructs the VCEMCLI how long to wait for
blocking commands.
–timeout seconds
When set, instructs the VCEMCLI how often to poll VCEM
for job or power status.
-pollinginterval seconds
Using the VCEMCLI in a script
The following example illustrates how the VCEMCLI can be used to automate common profile
management tasks. This example:
•
Powers on the servers in the enclosure
•
Creates server profiles
•
Adds and edits network connections for the server profiles
•
Assigns server profiles to the bays that contain servers
@echo off
set CLI=vcemcli.exe
set VCDG=OA-78-VCDG
set NEWNET=NET2
set MAXPROFILES=5
set MAXBAYS=16
set ENCLNAME=OA-78
set VCEMCLI=-logfile c:\demo.log
echo Turn on all servers in enclosure %ENCLNAME% --------------------------------------------
for /L %%I in (1,1,%MAXBAYS%) DO (
%CLI% -show power-status -enclosureName %ENCLNAME% -bayname %%I
if ERRORLEVEL 240 (
echo There is no server in bay %%I
) else (
if ERRORLEVEL 1 (
echo Server in bay %%I is already on
) else (
echo Turning on server in bay %%I
%CLI% -poweron devicebay -enclosureName %ENCLNAME% -bayname %%I
if ERRORLEVEL 1 goto ERRORHANDLER
)
)
)
echo Creating %MAXPROFILES% profiles -------------------------------------------------------
for /L %%I in (1,1,%MAXPROFILES%) DO (
echo Creating profile %%I of %MAXPROFILES%
%CLI% -add profile -vcdomaingroup %VCDG% -profilename PROFILE-%%I
if ERRORLEVEL 1 goto ERRORHANDLER
)
echo Profile creation complete - adding network connections --------------------------------
for /L %%I in (1,1,%MAXPROFILES%) DO (
echo Adding enet connection to PROFILE-%%I
%CLI% -add enet-connection -profilename PROFILE-%%I
if ERRORLEVEL 1 goto ERRORHANDLER
)
10
Using the VCEMCLI