I really like Altaro VM Backup! It’s so simple, fast and gets the job done. If you haven’t tried it yet, please do – it fulfills the backup needs of small and medium businesses. I’m using it for backup of my Hyper-V virtual machines, of course.
Have I mentioned that they also have the free version, because – they do!
With this little digression out of the way, the thing I want to write now is something that really helped me the other day. I created (yet another) virtual machine on my Hyper-V host and then I tried to add it to backup as well. It is really simple to do this in Altaro – you just select your virtual machine and then drag & drop it to the desired backup location and schedule and that’s it!
As I was connected to my host via Remote Desktop, I was having trouble with drag & drop. I wasn’t able to add my new virtual machine to either backup location or schedule. I’m stuck.
So… when all things fail, you’re usually saved by “reading the friendly manual” (RTFM). Or by using PowerShell. I’ve decided to try the latter.
How do you use PowerShell to add the virtual machine to backup when using Altaro VM Backup?
There are a couple of steps, but basically you need to establish the connection to backup server, make Altaro VM Backup aware of your virtual machine, assign it to the desired backup location and schedule. And that’s it! And, even better – the good people at Altaro have written the PowerShell scripts that help you do all that!
The steps are:
- (inside PowerShell console) go to the C:\Program Files\Altaro\Altaro Backup\Cmdlets where here you can see all the scripts that come out-of-the-box:
- all scripts are equipped with help and examples, accessible by adding the –help parameter:
- first, we need to establish connection to backup server by using the StartSessionPasswordHidden.ps1 scripts (that will give us connection to the backup server and also Session token (Data field) which we need as first parameter for all the next steps):
- next, we need to make Altaro VM Backup aware of our new virtual machine by getting the HypervisorVirtualMachineUuid of this virtual machine with GetVirtualMachines.ps1 script:
- then we can add this virtual machine to Altaro with AddVirtualMachineToConfig.ps1 script by passing the Data (actually the VirtualMachineRefId) value from the previous step:
- next, we need to check our available backup locations with GetBackupLocations.ps1 script:
- by using the AddVirtualMachineToBackupLocation.ps1 with BackupLocationId from the previous step, we will assign our virtual machine to desired backup location:
- next, we need to add this virtual machine to a desired schedule as well – with GetSchedules.ps1 script, we can get the ScheduleId:
- and with this parameter in hand, we can start the AddVirtualMachineToSchedule.ps1 script:
- last, but not least, we need to close all sessions by using the EndAllSessions.ps1 script:
- finally, we can see the results in the GUI (our machine should be added to the backup location and schedule – everything that’s needed to start backing it up!):
Pretty simple (and cool), right?! Hope it helps!