Press "Enter" to skip to content

Scripting a Zerto Recovery Plan v2

Joshua Stenhouse 4

One of the most popular blog posts in the archive has been scripting recovery plans in Zerto. This is most likely because one of the most frequent requests I hear is the ability to control the boot ordering of Virtual Protection Groups (VPGs), not just the VMs within a VPG. This makes total sense when you have multiple tiers of applications and you want to recover them in order of priority or based on inter-dependencies.

In version 5.0 U2, Zerto included the ability to reverse the protection using the REST API. This meant I could finally deliver a script that automates failover and failback operations in a orchestrated fashion! In a first for I decided to give an overview of the script using a video:

If you found the video useful please like it on youtube. If I get enough likes I will do more video explanations in the future as I think it makes the scripts easier to consume. To get you started with scripting your own recovery plan click to download example below:

The only major requirement of the script which you might not already have is ZVR 5.0 U2. If you haven’t already updated, this is as good a reason as any to upgrade today. Happy scripting,


  1. Dazza Dazza

    Hi Josh. Loving some of your REST API blog articles and videos. As a prospective customer of Zerto, looking at the product, I do have to ask why oh why so much of this isn’t in the product itself. Multi-VPG “run books” / boot orders, reporting on protected and unprotected VMs, default VPG settings, web based VPG SLA reports for management, …… I could go on. For a product that is (let’s face it) quite expensive why do customers have to do this stuff by script?! Yes, REST API is important for those than need ultimate customisation and integration with vRO, but small houses don’t have the people or skills to be using and maintaining this stuff. I know you have quite good PDFs and sample scripts, but so much of this should also be in the product IMO.

    • Joshua Stenhouse Joshua Stenhouse

      Hey Dazza. Thanks for the kind words and I couldn’t agree with you more! I spent 4.5 years at Zerto campaigning for this to be baked in so it was simple to use and never succeeded. I wrote the script to prove the need and shot myself in the foot because I was then told there is no need, just use your script. Doh!

  2. Hi Joshua, when we do test failovers the VM’s are configured as Vapps and run all the I/O via the VRA’s. As we’re a BC/DR provider our customers run BC/DR Rehearsals for days and on occasions a whole week, while they test phone failovers and all manner of other business plans.

    I know Zerto does not like running ‘test’ failovers for very long for exactly the above reasons and the journalling limits, so my question is, can we cleanly get a copy of the failed over VM’s in some way without interfering with Zerto in the ‘test’ failover process and once we have the clean copies of the VM’s tell Zerto we have finished the ‘test’ and it will tidy up what it did and leave us with a clean set of VM’s for our customer to test for as long as they want.

    Clearly this would only be for rehearsals and if the real thing did happen then we’d be using the script above to control it, but for this type of exercise is this at all possible? I’d appreciate your input.

    Thank you

    • Joshua Stenhouse Joshua Stenhouse

      Hey Paul. Great to hear from someone at a company both worked for and sold to! Sorry for my late reply, catching up on a backlog of comments. You certainly can get a “clean copy” of the VMs for extended rehearsals, but the caveat is that it’s a full VMware clone so you need double the storage. I do have a script to automate this if its still of interest?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: