Utilising a script called esxi-control.pl we are able to do this on a Windows machine with vCLI installed (preferably the KMS machine itself).
You will now need to decide on a method of reactivating the clients. I opted to make a startup script that ran "slmgr /ato", but you can also use pfexec (if you have set a password on the initial account). If you opt to create a startup script, you will need to create a new additional snapshot for each "machine" to save it (obviously you should include this in the image building process outlined in the previous entry).
Once you have decided on this, create the following batch script on the server you have installed vCLI on:
@echo off
REM Note: virtual machine must be powered on for script to change to a different snapshot, this script overcomes this with the two if statements below.
SET numofmach=24
SET seconds=60
EditV32 -p "Enter a password: " -m passwd
SET /a count=%numofmach%+1
FOR /L %%i IN (1,1,%count%) DO (
REM Start machine
esxi-control.pl --server esxi --username root --password %passwd% --action poweron --vmname kms-maintain
IF NOT "%%i"=="1" (
echo Waiting for machine to start
@ping 127.0.0.1 -n 2 -w 1000 > nul
@ping 127.0.0.1 -n %seconds% -w 1000 > nul
REM Activate, you could use psexec here:
REM psexec \\kms-maintain -u user -p blah "slmgr /ato"
REM or just use a startup script on machine
)
IF NOT "%%i"=="%count%" (
REM Change to next snapshot
esxi-control.pl --server esxi --username root --password %passwd% --action revert-to-snapshot --snapshotname activate-%%i --vmname kms-maintain
)
)
No comments:
Post a Comment