Using vcemcli in a script – HP Insight Management-Software User Manual
Page 9
Table 1 Common options (continued)
Description
CLI options
NOTE:
When using this option, it is possible that
sequential edits queued for the same profile may conflict
with the changes being applied. HP recommends that you
use blocking operations when performing multiple changes
to a given profile. This ensures that the changes for each
edit are applied to the profile before the next group of
changes are initiated.
Suppresses output from VCEMCLI.
–silent
When set, instructs VCEMCLI how long to wait for blocking
commands.
–timeout seconds
When set, instructs VCEMCLI how often to poll VCEM for
job or power status.
-pollinginterval seconds
Using VCEMCLI in a script
The following example illustrates how 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 containing 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
)
echo Add network connection complete - Update network connections --------------------------
for /L %%I in (1,1,%MAXPROFILES%) DO (
echo Assigning enet connection %NEWNET% to port 3 of PROFILE-%%I
%CLI% -set enet-connection -profilename PROFILE-%%I -network %NEWNET% -portnumber 3
if ERRORLEVEL 1 goto ERRORHANDLER
Using VCEMCLI in a script
9