Managing Altaro VM Backup with PowerShell

Recently, I decided to try to determine if there was a way to manage Altaro VM Backup with PowerShell. I figured there must be some database, files, or something that I could at least query with PowerShell.

What I found is Altaro has a RESTful API and they have numerous PowerShell scripts for working with it. In Altaro version 7, there are 33 PowerShell scripts located in the “C:\Program Files\Altaro\Altaro Backup\Cmdlets” folder if you took the defaults during the installation, otherwise they’re wherever you installed Altaro. Altaro has a blog article on their website announcing the API in March of 2016.

After taking a look at Altaro’s PowerShell scripts, I decided not to use them. I started writing my own PowerShell module with functions for working with their API.

Although their API has a limitation that it only works locally on the actual Altaro VM Backup server, that doesn’t mean that you can’t use it with PowerShell remoting. Working remotely is always better from a manageability standpoint since using remote desktop to connect to the server only to run PowerShell on it locally defeats the whole purpose of using PowerShell.

I’ll start out by storing my credentials in a variable named Cred:

Use one-to-one remoting to access my Altaro VM Backup server:

The Altaro API service is disabled by default. Set it to start automatically and then start the service:

The Start-MrAltaroSession function shown in the following code example is used to start a session with the API on an Altaro VM Backup server:

From this point forward, I can use the Using variable scope modifier with the credentials I stored in the local variable named Cred on the remote server.

Use the Start-MrAltaroSession function to start a new session with the API:

Errors are returned as an actual error:

The Get-MrAltaroOperationStatus function is used to retrieve the status of operations that are currently running:

These include backups, offsite copies, restores, and seed to disks operations:

You can also pipe Start-MrAltaroSession directly to Get-MrAltaroOperationStatus:

The Stop-MrAltaroSession function gracefully closes out of one or more sessions that were previously opened:

It can be used to stop a single session. If multiple sessions existed, the SessionId parameter could be specified to stop a single session.

By default, if multiple sessions exist, it stops all of them:

A warning is returned if no sessions exist:

The functions shown in this blog article are part of my MrAltaro PowerShell script module which can be downloaded from my Altaro repository on GitHub.

For more information about the Altaro RESTful API, see their documentation page.

µ

Leave a Reply

%d bloggers like this: