Powershell & Veeam Backup and Replication / VeeamZip

First things first: this is not a sponsored article.

I came across Veeam products multiple times in my career,  but most of the customers or companies that I worked for were using other products with no compelling reason for migrating from backup solutions that already worked efficiently with another one.

In the last couple of years, I’ve attended to VMWare UserCon and met some guys from Veeam, that was one of the sponsors of the event in here Melbourne (Australia). They were very approachable and kind to show that the company had a lot of new solutions to offer and one, in particular, it was too good to be true.

The solution was called VeeamZIP and now is part of a product called Veeam Backup and Replication. It’s free, it’s supported by the company (I think just via the forum or email) which I think is a very important point and not just support VM WARE (vSphere) and MS Hyper-V, but have a neat graphical console and a cli… that it’s Powershell! Working with VMWare or HyperV means already being capable of using Powershell, but using it also for the backup (or other features) it’s a big bonus. I can’t find any drawback on this product, really.

As DevOps /System Engineer I also work a lot on lower (dev/test) environments that sometimes have a very short life, not entirely managed by a configuration manager. So these environments are made of a lot of moving parts that are not stateless or immutable, so I can’t simply “destroy” them and rebuild them entirely from scratch without spending a considerable amount of time.

In this scenario is being flexible and fast means at the same time an efficient use of time and money. The best solution, in this case, is not necessarily free but the one that perfectly meets and matches the requirements.

The Requirements

The requirements in my case were meeting the needs of Developers and Operations to archive/freeze sometimes multiple VMs on demand as described before.
These are not basically checkpoints or daily backups, but more an ad-hoc process for temporary projects or proof of concepts.  So I wanted to exclude them from the production backups part of the business continuity/disaster recovery plan. 

This data/system is important enough to be backed up, but it’s not critical for the business. Especially in my case over time the number of these VMs it’s in the order of hundreds and growing over time and if not managed properly it’s noise or simply too expensive to maintain.  

The compression rate for my standard size Windows VM with a couple of virtual disks was impressive, especially the speed for backup or restore was less than 5 minutes for each VM or a quick coffee break.

As a DevOps the neat UI to access and configure the tool is a bonus, but not exactly what I was looking for.  The CLI (powershell) offers the opportunity to tailor it to my needs.

For Example

If we tag VMs with a label like “PoC-001” (in Veeam B&R) and create a RBAC permission via the UI for developers we can provide from the UI the permission to backup or restore. But from the console/script that can be signed and ran on demand, we can trigger other events like an email to a distribution list or notify to a chatbot/chatops when the event is completed, add/remove rules to firewall or entry monitoring systems,  using rest api creating service desk tickets for these events for raising visibility and merging the flow of the project or company,  etc… and everything else you need or possibly think of.

This is a good starting point with Veeam PS Snapin:

https://helpcenter.veeam.com/docs/backup/powershell/getting_started.html?ver=95

Installing the Veeam Backup & Replication was a streamlined experience. The configuration as well, in my case, considering that the infrastructure and tool from VMWare and MS Hyper-V SCVMM were already there. I’ve used the UI to store the credentials, creating the users’ profiles (RBAC) and test the overall functionality.. then I started to work on the CLI.

So let’s start by exploring the free options in this article (VeeamZIP) included on Veeam Backup and Replication (the version I’ve tested and used is 9.5).

Ok, now that we are connected to the Veeam Backup server within our powershell session let’s connect to vSphere or HyperV and gather some of the settings.

Let’s define in our script the environment:

Let’s check if the VM and the node are there:

Let’s start the asynchronous backup job and in the meantime let’s send out an email with all the files and size occupied on disk on our backup repository/archive.

I hope you find this article interesting, as usual, you can find these code snippets on my GitHub repository.

After writing this article I’ve found a good one on an older version of VeeamZip that performs similar operations: https://www.veeam.com/blog/veeam-backup-free-edition-now-with-powershell.html

Leave a Reply

Your email address will not be published. Required fields are marked *

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