Host-based backup of VMware vSphere VMs.
Post Reply
soylent
Enthusiast
Posts: 61
Liked: 7 times
Joined: Aug 01, 2012 8:33 pm
Full Name: Max
Location: Fort Lauderdale, Florida
Contact:

Anyone using vsphere tags for backup jobs?

Post by soylent »

I am backing up my VMs by their vsphere tag, but I want to find all VMs not being backed up. I've been looking for a way to get a list of all untagged VMs, so I can see what is not being backed up.

But I've run into an issue: There is no way in the vcenter UI to get a list of all tagged VMs. It seems like such an obvious inventory view, but it's just not there. I can get a list of all VMs with a specific tag, but I can't get a list of all tagged and untagged VMs.

Is there a way in Veeam to list all untagged VMs, or VMs not in a backup job?
BartP
Veeam Software
Posts: 230
Liked: 62 times
Joined: Aug 31, 2015 8:24 am
Full Name: Bart Pellegrino
Location: Netherlands
Contact:

Re: Anyone using vsphere tags for backup jobs?

Post by BartP »

Hey Soylent,

You can use VeeamOne for this (https://helpcenter.veeam.com/docs/one/r ... tml?ver=95).
You can also use Powershell & PowerCLI to connect to the vCenter and get a list of all VMs with and without tag.
Unfortunately i'm not behind my work laptop, but i will subscribe to this topic and have a reminder to do it tomorrow.
Bart Pellegrino,
Technical Account Manager - EMEA
BartP
Veeam Software
Posts: 230
Liked: 62 times
Joined: Aug 31, 2015 8:24 am
Full Name: Bart Pellegrino
Location: Netherlands
Contact:

Re: Anyone using vsphere tags for backup jobs?

Post by BartP »

Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer -Server 192.168.0.1 -Force
$cat = Get-TagCategory -Name 'SLA'
Get-VM | Where{!(Get-TagAssignment -Entity $_ -Category $cat)} | Select Name,@{N="Tag";E={(Get-TagAssignment $_.name).tag}}

The bold items need to be changed to match your environment
Bart Pellegrino,
Technical Account Manager - EMEA
soylent
Enthusiast
Posts: 61
Liked: 7 times
Joined: Aug 01, 2012 8:33 pm
Full Name: Max
Location: Fort Lauderdale, Florida
Contact:

Re: Anyone using vsphere tags for backup jobs?

Post by soylent »

The problem with the powershell scripts is that the "Get-TagAssignment" cmdlet only lists VMs with tags assigned. I need a way to list VM's without a tag. Or just a list of all VMs including tag info.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Anyone using vsphere tags for backup jobs?

Post by veremin »

It should not be that hard to subtract list of tagged VMs from list of all VMs. The resulting value would be VMs without a tag.

Otherwise, you can reverse the script selection logic, so that only VMs (for which Get-TagAssignment cmdlet returns $Null) get returned.

Thanks.
BartP
Veeam Software
Posts: 230
Liked: 62 times
Joined: Aug 31, 2015 8:24 am
Full Name: Bart Pellegrino
Location: Netherlands
Contact:

Re: Anyone using vsphere tags for backup jobs?

Post by BartP »

Not needed.
The script has a “!” Included which acts as a Not within the statement.
It does exactly as requested. Remove the ! And you will only get VMS with a tag. Now it returns all VMS without a tag 8)

Edit: Removed typo
Bart Pellegrino,
Technical Account Manager - EMEA
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Anyone using vsphere tags for backup jobs?

Post by veremin »

Ah, I must have missed exclamation mark, while reviewing the script. Then, indeed, no additional modifications are needed. Thanks.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 73 guests