Friday, April 3, 2009

vcmd

This is the script I use to send vmware-cmd commands to my VMWare host servers. This assumes you have installed the Vmware VI Remote CLI app that includes perl (I installed the package VMware-VIRemoteCLI-3.5.0-104314.exe):


@echo off

REM --------------------------------------------------------------------------------------------------------------
REM Usage
REM vcmd [ESXi Host] "[command]"
REM
REM Be sure to enclose the command in "" marks
REM
REM This batch file assumes that the public private key pairing has been configured on the ESXi Host
REM
REM This batch file will send the [command] to the [ESXi Host] using a private key. This allows a script
REM access to the ESXi Host without the need to login in order to automate tasks
REM
REM This batch file is called from other batch files.
REM
REM DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING!!!
REM --------------------------------------------------------------------------------------------------------------

perl "C:\Program Files\VMware\VMware VI Remote CLI\bin\vmware-cmd.pl" -v -H %1 -U root -P password %2 %3 %4 %5 %6


As you can see the usage is vcmd.bat [ESXi Host] "[command]"
You will need to change the path to the private key you created from my previous post. Make sure you enclose the command in "'s

No comments:

Post a Comment