Get all used backup repositories of a backup job

PowerShell script exchange

Get all used backup repositories of a backup job

Veeam Logoby edirschedl » Wed Aug 09, 2017 8:46 am

Hi,

we have some big scale-out repositories with a lot of extends.
With help of a script, I want to get all used extends of a single backup job. So for example I've a job called "Backup 1" and it has backup files on "Extend 1", "Extend 2" and "Extend 3" in a Scale-Out-Repo with 10 extends total.
How do I get this information on which extends there are backup files of this specific backup job - with help of a powershell script?


Thank you for your tips / advices.

Emanuel
edirschedl
Enthusiast
 
Posts: 30
Liked: 2 times
Joined: Thu Jul 21, 2016 12:29 pm
Full Name: Emanuel Dirschedl

Re: Get all used backup repositories of a backup job

Veeam Logoby v.Eremin » Wed Aug 09, 2017 5:38 pm

Backup object (Get-VBRBackup) contains identifier of repository it resides on ($Backup.info.RepositoryId).

If my assumption is correct and this property provides identifier of extent, not of Scale-Out Backup Repository as a whole, you should be able to find needed extent, using it. (VBRRepositoryExtent)
v.Eremin
Veeam Software
 
Posts: 14818
Liked: 1113 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Get all used backup repositories of a backup job

Veeam Logoby edirschedl » Fri Aug 11, 2017 5:45 am

Sadly RepositoryID is the same ID as the Scale-Repo itself (or ParentID from the single extents). So that's no information to get the specific extents where the backup files are located.
edirschedl
Enthusiast
 
Posts: 30
Liked: 2 times
Joined: Thu Jul 21, 2016 12:29 pm
Full Name: Emanuel Dirschedl

Re: Get all used backup repositories of a backup job

Veeam Logoby v.Eremin » Fri Aug 11, 2017 4:20 pm 1 person likes this post

I do not have a good lab at hand to test the script, but at least it should give you the right directions:

Code: Select all
Asnp VeeamPssnapin
$Backup = (Get-VBRBackup | where {$_.Jobname -eq "Name of job pointed to SOBR"})
$Backup.GetOibs() | select name, {$_.FindChainRepositories().name}

Thanks.
v.Eremin
Veeam Software
 
Posts: 14818
Liked: 1113 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Get all used backup repositories of a backup job

Veeam Logoby edirschedl » Tue Aug 29, 2017 8:15 am

Thank you very much! It works without problems now.
edirschedl
Enthusiast
 
Posts: 30
Liked: 2 times
Joined: Thu Jul 21, 2016 12:29 pm
Full Name: Emanuel Dirschedl

Re: Get all used backup repositories of a backup job

Veeam Logoby v.Eremin » Tue Aug 29, 2017 10:31 am

You're welcome, if you want to get more smooth output, you can enhance the script further:

Code: Select all
Asnp VeeamPssnapin
$Backup = (Get-VBRBackup | where {$_.Jobname -eq "Name of job pointed to SOBR"})
$Backup.GetOibs() | select @{N="Name";E={$_.Name}}, @{N="Repository Name";E={$_.FindChainRepositories().name}} | ft -AutoSize

Anyway, glad to hear my input was helpful. Let us know, should other questions arise.

Thanks.
v.Eremin
Veeam Software
 
Posts: 14818
Liked: 1113 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] Get all used backup repositories of a backup job

Veeam Logoby keith.sng » Sun Sep 03, 2017 9:28 am

Dear all,

Would like to know if someone can advise on how to generate out all the Backup Jobs listing within a Scale-Out Backup Repository using Powershell Scripts?

As this can be seen via the GUI but a customer is performing some migration and powershell output will be a much easier way to view ...

default scripts of:
Get-VBRRepositoryExtent -Repository "Name of Scale-Out" only returns the extents

Thanks in advance...
keith.sng
Veeam Software
 
Posts: 17
Liked: never
Joined: Mon Jan 16, 2017 8:47 am
Full Name: Keith Sng Chee Keong

Re: Get all used backup repositories of a backup job

Veeam Logoby v.Eremin » Mon Sep 04, 2017 1:00 pm

Using script above, you can get all backups stored on particular SOBR along with names of extents those backups reside on. Is that something you're looking for?
v.Eremin
Veeam Software
 
Posts: 14818
Liked: 1113 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Get all used backup repositories of a backup job

Veeam Logoby keith.sng » Thu Sep 07, 2017 4:40 am

Hi,

For this, we have to specify the Backup Job Name which is rather tedious as our customer has a quite a large number of Jobs in place.

Ray has assisted and contributed to the following scripts..

Code: Select all
$Backup = (Get-VBRBackup | where {$_.Jobname -like "*"})
Foreach($Backup in $Backup) {
$Job = Get-VBRJob -name $Backup.JobName
$Backup.GetOibs() | select name, {$_.FindChainRepositories().name}, {$Backup.JobName},{(Get-VBRBackupRepository -ScaleOut | Where {$_.Id -eq $Job.Info.TargetRepositoryId}).Name}
}
keith.sng
Veeam Software
 
Posts: 17
Liked: never
Joined: Mon Jan 16, 2017 8:47 am
Full Name: Keith Sng Chee Keong

[MERGED] Get All Jobs From SOBR

Veeam Logoby HCJ III » Tue Mar 20, 2018 9:05 pm

Previously I could use the Veeam Powershell snap-in to run a for each loop on Get-VBRBackupRepository and then call method getBackups() to return all Backup Jobs and their attributes like JobName, etc. for each Repository .

But SOBR Repositories do not return with Get-VBRBackupRepository.

They do Return with Get-VBRBackupRepository -Scaleout but the getBackups() methods is not available for Scaleout.

Is anyone aware of a method similar to getBackups() that will return Backup Job information for SOBR repositories (i.e. Get-VBRBackupRepository -Scaleout)?

Thanks in advance.
HCJ III
Lurker
 
Posts: 1
Liked: never
Joined: Tue Mar 20, 2018 8:54 pm
Full Name: Harry C. Johnson

Re: Get all used backup repositories of a backup job

Veeam Logoby v.Eremin » Wed Mar 21, 2018 10:54 am

Kindly, check the scripts provided above; should be exactly what you're looking for. Thanks.
v.Eremin
Veeam Software
 
Posts: 14818
Liked: 1113 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Get all used backup repositories of a backup job

Veeam Logoby tdewin » Mon Apr 30, 2018 2:54 pm

FYI if anybody needs this for getting Full paths. A lot of wild stuff here so I wouldn't deem it very reliable :)
Code: Select all
$sobrjob = Get-VBRJob -name "lin-sobr"
$linsobr = [Veeam.Backup.Core.CBackup]::GetAllByJob($sobrjob.Id)
$realsobr = $linsobr.GetRepository()
$svc = [Veeam.Backup.Core.CStorageToExtentAssociationService]::new()

$linstorages = @($linsobr.GetAllStorages())
$paths = @()
foreach($st in $linstorages) {
    $ext = $realsobr.FindExtentRepo($st.Id,$svc)
    $paths += New-Object -TypeName psobject -Property @{ext=$ext.Name;path=$($ext.Path.ToString(),$sobrjob.Name,$st.filepath -join "\")}
}
$paths


output
Code: Select all
ext    path                                           
---    ----                                           
sobr02 F:\sobr02\lin-sobr\lin1.30D2018-04-30T142340.vib
sobr01 F:\sobr01\lin-sobr\lin1.30D2018-04-30T142128.vbk
tdewin
Veeam Software
 
Posts: 1280
Liked: 421 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests