This batch file will register a vm on an ESXi server. This assumes you have configured the public/private key authentication and that you have installed the vmware cli utility for ESXi:
@echo off
REM --------------------------------------------------------------------------------------------------------------
REM Usage
REM
REM This file has 2 variations on input:
REM
REM Option 1
REM register [ESXi Host] [vmxname] [Resource] [Pool]
REM if you pass 4 variables to the file it will assume you have a vm with the structure [vmxname] vmxname/vmxname.vmx
REM We use resouce pools with 2 names (ie: Maintenance Systems, Development Systems, etc) which is why there's the "%3 %4" at the end
REM
REM Option 2
REM register [ESXi Host] [vmxname] [Resource] [Pool] [full vmx path]
REM If you pass 5 varialbes the second variable is ignored and the 5th variable should be the full path to the vmx file.
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 --------------------------------------------------------------------------------------------------------------
if %5=="" (
perl "C:\Program Files\VMware\VMware VI Remote CLI\bin\vmware-cmd.pl" -v -H %1 -U root -P password -s register "[%2] %2/%2.vmx" %1 "%3 %4"
) else (
perl "C:\Program Files\VMware\VMware VI Remote CLI\bin\vmware-cmd.pl" -v -H %1 -U root -P password -s register %5 %1 "%3 %4"
)
make sure you change password to your password.
Friday, April 3, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment