List objects in Backup Copy Jobs

PowerShell script exchange

List objects in Backup Copy Jobs

Veeam Logoby TGM406 » Thu Feb 04, 2016 4:16 pm

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
}
TGM406
Novice
 
Posts: 3
Liked: never
Joined: Thu Feb 04, 2016 4:04 pm
Full Name: Tommy G Mikkelsen

Re: List objects in Backup Copy Jobs

Veeam Logoby PTide » Thu Feb 04, 2016 6:23 pm

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.
PTide
Veeam Software
 
Posts: 3140
Liked: 262 times
Joined: Tue May 19, 2015 1:46 pm

Re: List objects in Backup Copy Jobs

Veeam Logoby nefes » Fri Feb 05, 2016 11:28 am

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?
nefes
Veeam Software
 
Posts: 543
Liked: 128 times
Joined: Mon Dec 10, 2012 8:44 am
Full Name: Nikita Efes

Re: List objects in Backup Copy Jobs

Veeam Logoby v.Eremin » Fri Feb 05, 2016 11:29 am

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.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: List objects in Backup Copy Jobs

Veeam Logoby TGM406 » Fri Feb 05, 2016 2:06 pm

Hi

The vm's is added as backup job objects.
TGM406
Novice
 
Posts: 3
Liked: never
Joined: Thu Feb 04, 2016 4:04 pm
Full Name: Tommy G Mikkelsen

Re: List objects in Backup Copy Jobs

Veeam Logoby v.Eremin » Fri Feb 05, 2016 2:36 pm 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.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: List objects in Backup Copy Jobs

Veeam Logoby TGM406 » Mon Feb 08, 2016 10:21 am

Just what I was searching for, thanks v.Eremin
TGM406
Novice
 
Posts: 3
Liked: never
Joined: Thu Feb 04, 2016 4:04 pm
Full Name: Tommy G Mikkelsen

Re: List objects in Backup Copy Jobs

Veeam Logoby v.Eremin » Mon Feb 08, 2016 10:48 am

You're welcome. Should other help with scripting be needed, don't hesitate to let me know. Thanks.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: List objects in Backup Copy Jobs

Veeam Logoby SCITB » Fri Feb 19, 2016 9:32 am

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
SCITB
Lurker
 
Posts: 1
Liked: never
Joined: Fri Feb 19, 2016 9:26 am

[MERGED] List VMs in a Backup Copyjob

Veeam Logoby SRedlin » Thu Apr 13, 2017 1:06 pm

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?
SRedlin
Influencer
 
Posts: 10
Liked: 1 time
Joined: Fri Sep 23, 2016 10:20 am
Full Name: Stefan Redlin

Re: List VMs in a Backup Copyjob

Veeam Logoby Mike Resseler » Fri Apr 14, 2017 5:03 am

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
Mike Resseler
Veeam Software
 
Posts: 3345
Liked: 380 times
Joined: Fri Feb 08, 2013 3:08 pm
Location: Belgium, the land of the fries, the beer, the chocolate and the diamonds...
Full Name: Mike Resseler

Re: List objects in Backup Copy Jobs

Veeam Logoby v.Eremin » Fri Apr 14, 2017 9:45 am

Based on the source type, you need to use either my script or the one provided by TGM406. Thanks.
v.Eremin
Veeam Software
 
Posts: 13558
Liked: 1006 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 5 guests