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 » 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
}

P.Tide
Product Manager
Posts: 5230
Liked: 450 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: List objects in Backup Copy Jobs

Post by P.Tide » 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.

nefes
Veeam Software
Posts: 625
Liked: 155 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:

Re: List objects in Backup Copy Jobs

Post by nefes » 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?

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

Re: List objects in Backup Copy Jobs

Post by veremin » 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.

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 » Feb 05, 2016 2:06 pm

Hi

The vm's is added as backup job objects.

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

Re: List objects in Backup Copy Jobs

Post by veremin » 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.

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 » Feb 08, 2016 10:21 am

Just what I was searching for, thanks v.Eremin

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

Re: List objects in Backup Copy Jobs

Post by veremin » Feb 08, 2016 10:48 am

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 » 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

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 » 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?

Mike Resseler
Product Manager
Posts: 5701
Liked: 601 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 » 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

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

Re: List objects in Backup Copy Jobs

Post by veremin » 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests