How to use Veeam with custom VM attributes

Introduction

Today i’m writing about a Veeam feature which i haven’t seen a lot out in the field. In my opinion, you can use this feature to easily sort and evaluate the backup state of virtual machines backed up with Veeam Backup & Replication.

During the creation of a Veeam Backup Job, you are able to edit the notification settings. There is also a checkbox stating “Set successful backup details to this VM attribute”. If you select the checkbox, Veeam will write information about successfully performed backup and backup results to a VM attribute. You can either use an existing attribute like “Notes” or define a new attribute suited for your needs.

custom_attributes

In my case i only selected the “Set successful backup details to this VM attribute”. In this scenario, Veeam will create a new custom attribute called “VEEAM BACKUP” which will get filled with successful reports of a VM backup. If you also select “Append to the existing attributes’s value” Veeam will keep the values which have been added to that attribute. If you do not select this option, Veeam will overwrite the existing attribute value.

Testing Scenario

Since i’d like to show you some scenarios, i have set up a Veeam backup job with two virtual machines on which we are testing the custom attributes.

backup_job_vms

I’ve set up the notification settings for this backup job with the custom attribute as shown in this image

Advanced_Settings


In my scenario, Veeam will do the following

  • Create a custom attribute called “VEEAM BACKUP”
  • Fill the value of this attribute with information regarding a successful backup
  • Veeam will overwrite the value, each time a successful backup has been made

After a successful run of my newly created backup job, i can review the attribute within the VMware vSphere Client. The look and feel of a custom attribute in the vSphere Web Client is not the best, but quite good for a quick lookup if the VM has been backed up.

Without checking any events or consulting the Backup Administrator, you are quickly able to see if the VM has been backed up.

But to unleash the full power of this feature, we are going deeper into the PowerCLI!

The PowerCLI way

First of all, start a PowerCLI and connect to your vCenter Server. We are now going trough some basics

You can now see if Veeam created the new “VEEAM BACKUP” custom attribute with the following command.

Get-CustomAttribute "VEEAM BACKUP"
get_custom_attribute

If you want to see the annotation of this custom attribute regarding our freshly backed up VM, consider the following command.

Get-Annotation -Entity NK-TEST -CustomAttribute "VEEAM BACKUP" | fl

To tidy up some unneeded parameters, go for the following command. This one will give you only the name of the virtual machine and the value of your custom attribute.

get-vm NK-Test,NK-Test2 | Get-Annotation -CustomAttribute "VEEAM BACKUP" | Format-List -Property AnnotatedEntity,Value
get_annotation_details

If you replace the virtual machine names with a wildcard, you will get all virtual machines with this Custom Attribute and its value. This command would be useful to check, if all virtual machines have a value and therefore have been backed up.

get-vm * | Get-Annotation -CustomAttribute "VEEAM BACKUP" | Format-List -Property AnnotatedEntity,Value
get_annotation_of_all_vms

But this command would not be useful in big environments. Therefore you should use something which gives you all virtual machines which have not any value in the custom attribute. Due to an empty value, you can be sure, that there was no backup for this virtual machine. In this case, you can use the following command.

get-vm * | Get-Annotation -CustomAttribute "VEEAM BACKUP" | where-object {$_.Value -eq "$null" } | Format-List -Property AnnotatedEntity,Value
get_annotation_of_all_vms_with_missing_value

In my scenario, there are two virtual machines, which have not been backed up.

Conclusion

When Assuming, that you have set up all Veeam backup jobs to write a value to a custom attribute, you can easily get the state of all virtual machines via PowerCLI.

This does not replace any monitoring or reporting solution such as Veeam ONE, but indeed it is very straight forward to get what you need. I just wanted to show you a quick way on how to manage the backup state of your virtual machines.

For example, you could export my commands above into a .csv file. After doing so, you could schedule the command for collecting the “backup state” of your virtual machines.

I hope i could maybe give you some arguments why you could be thinking about using this feature ๐Ÿ™‚

Thanks for reading and have a nice day !


About Falko Banaszak

Falko is a Consulting Field Solutions Architect for Modern Data Protection based in Germany working at Pure Storage Inc. In the last 12 years he has built a strong focus on virtualization, BCDR and has a passion for Microsoft 365 & storage systems. He's a Veeam Vanguard, a Veeam Certified Engineer, Veeam Certified Architect and a Veeam User Group founder and leader in Germany.

Check Also

vSphere Tagging Tool HTML5

Supercharge Excel with ChatGPT

Introduction and why I Supercharge Excel with ChatGPT When you read โ€œSupercharge Excel with ChatGPTโ€, …

3 comments

  1. Mark Aughenbaugh

    Great explanation and demonstration. How would you recommend handling agent based backups? The Notification section doesn’t have the ability to update a custom attribute for agent based backups. I would assume some kind of post script (Script tab) using powercli but how would you pass in the Veeam job status info to that script?

    • Falko Banaszak

      Hi Mark,
      yes I would use some sort of script. I guess you were pointing out to virtual machines on which you need to install an agent to, because it is not “backupable” due to some limitations like pRDM’s right ? In that case I’d trigger a post job script to update the custom attribute after the job has run.

Leave a Reply

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