How to automate vm snapshot creation using csv and schedule automatic deletion of the snapshot using VRO 8

Snapshot is one of the great feature which we have in vSphere and which can be used like backup whenever we want to perform any change in Virtual Machine.

There are multiple ways to take the snapshot for VM using multiple products/Language.
We can use vSphere GUI or Rest APIs or pyvmomi or PowerCli .

Also as precaution when take snapshot , it is recommended to delete the snapshot after x amount of times unless we will end up in datastore full or High space utilization by vmdk .

And this is our topic of discussion of today where we automate the creation of snapshot and deletion using vro.
As we know PowerCli is great language to automate the stuff in vSphere and in VRO 8 it has been added as addtional language followed by Python.

I have used PowerCli for this workflow.

Also I have used Mime attachment as Input of CSV and Datagrid custom form element to display the existing snapshot in table.

Lets see the demo when we choose single VM from drop down

As we see once create snapshot is completed ,It will create schedule for deletion of the snapshot

For Single VM I am not checking for existing Snapshot , If you need you can take reference from multiple VM input where we are checking existing

Lets look into demo of Multiple VM’s snapshot ,where we are using CSV file as input , To process the CSV I am using Mime attachment

As you see in logs , If you specify the VM in CSV which is not in vCenter it will throw error in logs but It will not stop for other vms , If you need you can put stop on that also .

Here is the link for Package , which includes all actions and workflow related to this.

We can follow this Instruction to Import the Package

Once we are done with Import Package , Just changed the Variable value in VRO and enter your vCenter Name , UserID and Password

Here is my CSV file Sample, You do not need to have PowerState, Only thing is required is It should have name in heading

Disclaimer: We can not use this workflow as XAAS as Mime attachment is currently not supported in Service Broker for VRA8.4 .

3 responses to “How to automate vm snapshot creation using csv and schedule automatic deletion of the snapshot using VRO 8”

  1. I am getting the following error, while run workflow.

    There was a problem invoking action com.VMwareCode/Check_Existing_Snapshot;
    [1][datagrid_61bf1418.value][com.VMwareCode/Check_Existing_Snapshot] Wrapped java.lang.IllegalStateException: Polyglot scripting is not supported with the current license.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at

%d bloggers like this: