PowerShell script exchange
Post Reply
Andr2210
Novice
Posts: 5
Liked: never
Joined: Nov 28, 2023 11:19 am
Full Name: Andr2210
Contact:

List of VMs specified using the tag

Post by Andr2210 »

I have a VMwareBackup task, the VMs are specified in the task using a tag.
This is how I get the tags specified in the task.

Get-VBRJob -name "Backup_VM_RBUS_To_Tape" | Get-VBRJobObject

To_Tape_BUS is a tag

Name Type ApproxSize Location
---- ---- ---------- --------
To_Tape_RBUS Include 976,3 GB 10.x.x.x\VM_BACKUP...
To_Tape_RBUS Include 105,5 GB 10.y.y.y\VM_BACKUP...

How to get a list of VMs that were included in the task?
If you put the cursor on a task in the Veeam B&R GUI, then a list of virtual machines that fall under the tag is displayed in the lower left frame. How do I get this list?
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: List of VMs specified using the tag

Post by david.domask »

Hi @Andr2210, use Find-VBRViEntity with the -Tags parameter to do a live lookup of what's under the tag. That hover-over item is a live look up also, tags are not inherent properties of a VM, they're handled by a separate service in VMware, so you must do a "live" look up each time.

Similarly, you can also check what was in a session with Get-VBRBackupSession and passing the resulting session object to Get-VBRTaskSession:

Code: Select all

PS C:\Users\Administrator> $job = Get-VBRJob -name 'tag-ps-ex'
PS C:\Users\Administrator> Get-VBRJobObject -Job $job

Name                      Type       ApproxSize       Location
----                      ----       ----------       --------
SomeTag Include    1.3 TB           some.vc.vsphere.local

PS C:\Users\Administrator> $job.FindLastSession().id
Guid
----
c72324ed-eb8a-4351-83a7-0fab96c3e45c
PS C:\Users\Administrator> $bSess = Get-VBRBackupSession -Id 'c72324ed-eb8a-4351-83a7-0fab96c3e45c'
PS C:\Users\Administrator> $tSess = Get-VBRTaskSession -Session $bSess
PS C:\Users\Administrator> $tSess.name
ddom-malware
ddom-ubuntu-backmeup
ddom-v12-cp3
ddom-somevm
ddom-tinyvm_replica
ddom-log-box
ddom-multi-disk
ddom-veeam-rb4
ddom-debian-backmeup_migrated
ddom-debian-backmeup_replica
ddom-tinyvm
ddom-tinyvm_restored
ddom-vtl
DDom-sql-test
ddom-ubuntu-hardened
ddom-vbr-v11
Those were added via tag as you can see, and while Get-VBRJobObject returns the correct object (the tag), we can check the tasks that way.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests