PowerShell script exchange
Post Reply
Andreswa777
Lurker
Posts: 2
Liked: never
Joined: Jan 07, 2019 9:53 am
Full Name: Andres
Contact:

Listing all jobs (& Objects within Jobs) in Veeam B&R

Post by Andreswa777 »

Once a month we have a Backup Selection report that we have to put together to show all the jobs within B&R.

Currently we are doing screenshots of the different Jobs categories (Backup, Replication, Backup Copy & Tape).
Within some of the jobs there are multiple Objects - e.g Tape (Category) -> Daily Backups (Job Name) -> Exchange Servers, Hyper V Cluster etc (Objects)

I managed to customize the (pretty epic) script from Shawn Masterson to pull all the Job Names, but it excludes the object names within a Job that might have multiple Objects.
This is one of the key aspects to show the client which servers are being backup within a generic Job name like "Hyper V Cluster (which holds 15 objects/servernames within).

Could someone assist with a script or something I could add to the "Get-VBRJob" Parameter?
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Listing all jobs (& Objects within Jobs) in Veeam B&R

Post by jhoughes »

Unfortunately, there is no functionality from the Veeam cmdlets which allows you to query the VM objects within/underneath those container objects (clusters, datastores, hosts, resource pools, or tags) within the virtual environment.

If you are targeting objects other than VMs, I always suggest to enumerate the matching backup, then use the GetObjects method to determine the VM objects which are in the backup itself.

Here's a walk-through for an example where I have a job which is leveraging tags.

This is my sample job which targets a tag (displaying short output of the job object to show that it is a tag):

Code: Select all

> Get-VBRJob -Name 'AUSVCENTER-TagTest' | Get-VBRJobObject | Select Object, TypeDisplayName

Object             TypeDisplayName
------             ---------------
Name: VeeamTagTest Tag
Next I capture the job into a variable, find the backup which has the matching job name, and save to a variable:

Code: Select all

> $tagtest = Get-VBRJob -Name 'AUSVCENTER-TagTest'
> $tagbackup = Get-VBRBackup | Where JobName -eq $tagtest.name
Then, I can leverage the GetObjects method to list out the objects contained within the backup itself (output trimmed to show that it contains multiple VM objects):

Code: Select all

> $tagbackup.GetObjects().count
4

> $tagbackup.GetObjects() | Select Name, ObjectID, Type

Name        ObjectId Type
----        -------- ----
ausjump01   vm-33      VM
ausdev01    vm-8654    VM
ausvcenter  vm-7371    VM
ausveeambem vm-118     VM
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests