Have you wanted to backup vmware sessions through backup exec? This is the way I do it and it works well for me. The script is scalable in case you add more vm sessions and if you port the script to another server.
We recently setup a Production VMWare server 1.01 environment for our monitoring server and BES 4.1 server plus a couple of mission critical servers. Due to our not fully knowing how Ubuntu Server 6.06 works we decided to go with windows server 2003 as the host OS. We want to put our dev environment on ubuntu but that is for a later date.
Right not one of the issues that I was having was backing up the virtual servers using Backup Exec 10d. After alot of tinkering I was able to automate the backup of the guest OSes through Backup Exec.
Here’s the code that I used to make all this possible:
:Begin Code
@echo off
call “C:\Program Files\VMware\VMware Server\vmware-cmd” -l > output.txt
for /F “tokens=1-10 delims=^” %%a in (output.txt) Do call “C:\Program Files\VMware\VMware Server\vmware-cmd” “%%a” suspend
del output.txt
:End Code
This code assumes that VMWare was installed to the default directory c:\Program Files\VMware\VMware Server. You can add this path to the system path so that you can obmit the path but then you have to remember to do that on any server you use this code.
Let’s break the code a bit:
vmware-cmd -l ( This is a vmware API command that list all the virtual machines ‘.vmx’ files that are under the Virtual Machines folder. )
The output is put in a output.txt. When the for loop runs it enters in the output 1 line at a time . It is important to use ^ as a delimiter since there’ s no other delimter you can use (space won’t work).
You have to use the ‘call’ command before vmware-cmd because for some reason if you don’t the command takes effect on only one server. Not sure why but it was annoying finding a way around this bug.
You can substitute suspend for start to start the vmware sessions.
Hope this can help any of you who run VMWare Server with windows.
Filed under: General, VMWare Server