PowerShell script exchange
TGM406
Service Provider
Posts: 14 Liked: never
Joined: Feb 04, 2016 4:04 pm
Full Name: Tommy G Mikkelsen
Contact:
Post
by TGM406 » Feb 04, 2016 4:16 pm
this post
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: 6551 Liked: 765 times
Joined: May 19, 2015 1:46 pm
Contact:
Post
by PTide » Feb 04, 2016 6:23 pm
this post
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: 649 Liked: 170 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:
Post
by nefes » Feb 05, 2016 11:28 am
this post
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: 20413 Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Feb 05, 2016 11:29 am
this post
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:
Post
by TGM406 » Feb 05, 2016 2:06 pm
this post
Hi
The vm's is added as backup job objects.
veremin
Product Manager
Posts: 20413 Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
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:
Post
by TGM406 » Feb 08, 2016 10:21 am
this post
Just what I was searching for, thanks v.Eremin
veremin
Product Manager
Posts: 20413 Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Feb 08, 2016 10:48 am
this post
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:
Post
by SCITB » Feb 19, 2016 9:32 am
this post
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:
Post
by SRedlin » Apr 13, 2017 1:06 pm
this post
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: 8191 Liked: 1322 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:
Post
by Mike Resseler » Apr 14, 2017 5:03 am
this post
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: 20413 Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Apr 14, 2017 9:45 am
this post
Based on the source type, you need to use either my script or the one provided by TGM406. Thanks.
Users browsing this forum: No registered users and 6 guests