Discussions specific to the VMware vSphere hypervisor
Post Reply
soylent
Enthusiast
Posts: 56
Liked: 5 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 » Nov 22, 2017 6:19 pm

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: 103
Liked: 35 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 » Nov 22, 2017 9:59 pm

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 Trainer EMEA

twitter: @bpellegrino
Check http://backitup.online for VMCE and VMCE-ADO study materials and practice exams

BartP
Veeam Software
Posts: 103
Liked: 35 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 » Nov 23, 2017 10:22 am

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 Trainer EMEA

twitter: @bpellegrino
Check http://backitup.online for VMCE and VMCE-ADO study materials and practice exams

soylent
Enthusiast
Posts: 56
Liked: 5 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 » Nov 28, 2017 3:25 pm

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: 16710
Liked: 1396 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Anyone using vsphere tags for backup jobs?

Post by veremin » Nov 28, 2017 3:41 pm

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: 103
Liked: 35 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 » Nov 28, 2017 8:55 pm

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 Trainer EMEA

twitter: @bpellegrino
Check http://backitup.online for VMCE and VMCE-ADO study materials and practice exams

veremin
Product Manager
Posts: 16710
Liked: 1396 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Anyone using vsphere tags for backup jobs?

Post by veremin » Nov 29, 2017 10:57 am

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: Baidu [Spider], Bing [Bot], Majestic-12 [Bot] and 11 guests