PowerShell script exchange
Post Reply
TGM406
Service Provider
Posts: 14
Liked: never
Joined: Feb 04, 2016 4:04 pm
Full Name: Tommy G Mikkelsen
Contact:

List objects in Backup Copy Jobs

Post by TGM406 »

Hi

I am trying to list all the objects in my Backup Copy Job, but the output is always empty
When I run it against a standard backup job,it works, but not against a backup copy job.
Is there another command to use for backup copy jobs?

I use the script below.

Code: Select all

asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue
$Jobname = "Test Backup Copy Job"
$job = Get-VBRJob -Name $Jobname

Write-Host "Objects in $Jobname"
$objects = $job.GetObjectsInJob()
foreach ($object in $objects) {
    Write-Host $object.Object.Name
}
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: List objects in Backup Copy Jobs

Post by PTide »

Hi,

Your script is fine, I've just tested it and all is good. Have you tried to input your script manually in PS, line by line and, and checking if any variable contains null value?

Thank you.
nefes
Veeam Software
Posts: 643
Liked: 162 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:

Re: List objects in Backup Copy Jobs

Post by nefes »

I suppose it can be dependent on how do you add objects to Backup Copy job.
Was it from Infrastructure, from Backup or from Job?
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List objects in Backup Copy Jobs

Post by veremin »

What is selected as a source for a backup copy job? Individual VMs or Backup Jobs? In the later case, the script has to be re-written slightly. Thanks.
TGM406
Service Provider
Posts: 14
Liked: never
Joined: Feb 04, 2016 4:04 pm
Full Name: Tommy G Mikkelsen
Contact:

Re: List objects in Backup Copy Jobs

Post by TGM406 »

Hi

The vm's is added as backup job objects.
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List objects in Backup Copy Jobs

Post by veremin » 1 person likes this post

Then, try the following example:

Code: Select all

asnp VeeamPSSnapin
$BCJ = Get-VBRJob -name "Name of your backup copy Job"
foreach ($Id in $BCJ.LinkedJobIds.Guid)
{
Get-VBRJob | where {$_.id -eq $Id} | select name
}
Thanks.
TGM406
Service Provider
Posts: 14
Liked: never
Joined: Feb 04, 2016 4:04 pm
Full Name: Tommy G Mikkelsen
Contact:

Re: List objects in Backup Copy Jobs

Post by TGM406 »

Just what I was searching for, thanks v.Eremin
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List objects in Backup Copy Jobs

Post by veremin »

You're welcome. Should other help with scripting be needed, don't hesitate to let me know. Thanks.
SCITB
Lurker
Posts: 1
Liked: never
Joined: Feb 19, 2016 9:26 am
Contact:

Re: List objects in Backup Copy Jobs

Post by SCITB »

Hi quick question - would this script be able to list all of the files that were backed up to a File To Tape job?

Veeam shows a certain number of files were backed up, but I cannot find any way to display that information.

Thanks
SRedlin
Influencer
Posts: 10
Liked: 1 time
Joined: Sep 23, 2016 10:20 am
Full Name: Stefan Redlin
Contact:

[MERGED] List VMs in a Backup Copyjob

Post by SRedlin »

Hey Folks,

i'am a little bit confused. When i'am using this lines of code.

Code: Select all

$test = Get-VBRJob -Name "Backup Job 1"

($test).GetObjectsInJob().name
I get all VM names in the jobs.

With a BackupCopy Job this won't work.

How can i extract the VMs in an Backup Copy job?
Mike Resseler
Product Manager
Posts: 8044
Liked: 1263 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:

Re: List VMs in a Backup Copyjob

Post by Mike Resseler »

Hi Stefan,

It looks like there is an issue as I just tried it out and experience the same problem. Could be a bug. I will ask QC to look at it.

Thanks
Mike
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List objects in Backup Copy Jobs

Post by veremin »

Based on the source type, you need to use either my script or the one provided by TGM406. Thanks.
Post Reply

Who is online

Users browsing this forum: oscarm and 17 guests