I’m now done with the new script and it’s working perfectly.

Background for the script:

At work we use vRanger to take DR snapshots of all our VM’s (more than 400).

We decided that we would only snapshot drive 0 and use a TSM client to backup the data in each VM and that the snapshots were only to be taken outside working hours.
These choices gave us some problems when running vRanger because we couldn’t schedule the snapshots from vRanger.

Because we have more than 400 VM’s we had to divide the list of witch VM’s to backup, into 14 days.
This means that one specific VM will only be snapshotted every 2 weeks.

In Virtual Center we created a custom field (=Backup) to tell the script witch VM’s to snapshot witch days.
We use full weekdays together with Even / Odd for dividing the VM’s into 14 days.
Ex. “Monday-Even” or “Sunday-Odd”

The solution was to make our own script that would handle the logic and just use vRanger to do the actual snapshotting.
We created a VBS script to hold the logic.
Create a log file
Delete snapshots from the day before (due to lack of storage space on the server)
Generate the .cmd file from information in a custom field (Backup) in VC
Call the .cmd file that was created earlier and contains the information on which VM’s to snapshot (Based on weekday – one file for each day).
Start TSM (send the VM’s snapshots to tape)
Send a status mail

(You have to use vRanger GUI to choose which drives to snapshot – changed from 3.17 -> 3.20)

I know this solution isn’t very dynamic but i works.

You can download the new script here – version 2.0.