Virtually Sober

If there is free booze and Virtualization; I'm there!

Category Archives: Scripting Basics

Introduction to Rubrik REST APIs using PowerShell & Swagger

One thing I’ve always been passionate about is writing scripts that are easy to read and consume. By showing you how to directly interact with REST APIs this enables you to do anything, and not be limited to the PowerShell functions provided by the vendor.

When it comes to working with REST APIs and PowerShell this starts to pay dividends when you want to take all the knowledge you’ve learned from working with 1 platform then use the same skills to connect and leverage another.

My first example of porting skills between platforms follows my recent journey of switching from working for Zerto to Rubrik. In this post I will give you all the information needed to connect and leverage Rubrik REST APIs using PowerShell.

Read more of this post

Top 10 PowerShell Tips & Tricks

In writing countless scripts over the past few years, I have learned many lessons on how to write scripts that are easier to read, more robust and perform ever more complicated tasks.

I recently had the pleasure of sharing these lessons with around 250 people on a Spiceworks webinar in the form of my top 10 PowerShell tips & tricks. I especially enjoyed the Q&A and live demo of my upcoming ZVR Recovery Plan v2 (coming very soon I promise). You can still watch the webinar recording by going to the link below and completing the form: Read more of this post

Introduction to PowerShell and Zerto REST API scripting

It has been quite some time since my last post and to make up for this I’m going to give you some seriously useful goodies, based on using PowerShell in combination with the Zerto REST API!

Utilizing PowerShell with the REST API opens up a world of possibilities as you are no longer restricted to solely using the PowerShell cmdlets provided by Zerto. You can now report and automate tasks that previously were only possible using the GUI. Below are some of the examples I’m going to be covering in the next few blog posts:

  1. Long term RPO & storage reporting
  2. Automating VRA deployment
  3. Automating VM protection with vRealize Orchestrator

Before we get into detail of specific examples you first need to build a PowerShell script to authenticate and create a session to the Zerto Virtual Manager and the vCenter it is connected to. Read more of this post

Adding Zerto cmdlets to a script

In order to run Zerto cmdlets inside a script you have to add the snapin. This is easily done with the following command:

add-pssnapin Zerto.PS.Commands

Read more of this post

Selecting Zerto Checkpoints in PowerShell

When using Zerto PowerShell cmdlets it can be required to select a checkpoint (a point in time) in the journal of changes from which to perform an operation. The Zerto PowerShell cmdlets which require a checkpoint to be defined are:


A checkpoint is also required for the POST APIs “Performing a Failover of a Specified VPG” and “Test a VPG for Failing Over”. To select a checkpoint the following cmdlet is used:

get-checkpoints -virtualprotectiongroup WebApp1 -zvmip -zvmport 9080 -username root -password Zerto123 -confirm:$false

Read more of this post

Scripting with Zerto Basics

To run PowerShell scripts with Zerto I recommend the following requirements be fulfilled, on the host running the scripts, as a best practice to cover running anything and everything:

  1. PowerShell 3.0 installed (available here)
  2. Zerto PowerShell Cmdlets 3.1 onwards (available from the Zerto Self-Service Portal here)
  3. Zerto PowerShell Security configured (see below)
  4. vSphere PowerCLI 5.5 (available here)
  5. Remote signed scripts allowed to run by running PowerShell as admin then the below cmd:
    “set-executionpolicy remotesigned”
  6. Ignore invalid certificate option set ignore to speed up connect-viserver operations by running PowerShell as admin then the below cmd:
    “set-PowerCLIConfiguration -invalidCertificateAction “ignore” -confirm:$false”

Read more of this post