PowerShell script exchange
Post Reply
Avshalom
Influencer
Posts: 18
Liked: never
Joined: Mar 30, 2014 8:00 am
Full Name: Avshalom
Contact:

Get Repositories by Tape Jobs

Post by Avshalom »

Hello Guys,

I need your help, Please

I have two Tape Backup Jobs "Backup to Tape Job 1", "Backup to Tape Job 2"
Each has different Backup Repositories on it, From the GUI i can see all the reposoitories on any of the jobs but i can't export it to file and check if i'm backing up all the repositories i have, and see if i seperate them well between the two backup jobs.

so my question is, how can i get by powershell cmdlet the list of the repositories on the tape jobs.
i tried to run:
Get-VBRTapeJob | Get-VBRBackupRepository

but it's not working, can you please help me with this, how to get the information??
thanks a lot
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Get Repositories by Tape Jobs

Post by tdewin »

Couldn't find it in the tape commands. As a tape job is inheriting from a regular job, most of the repository stuff is related to target repository which doesn't make sense for tape jobs in specific

I did retrieve it directly in the database I think. Not giving any guarantees cause the db is a mystery to me as well and of course it is not guaranteed that this will work in newer or older versions. Maybe for a one time query it could be useful . Also notice that my queries could be optimized by using joins ;)

Repositories related to jobs

Code: Select all

SELECT 
 (SELECT [name]
   FROM [VeeamBackup].[dbo].[Tape.jobs] WHERE [VeeamBackup].[dbo].[Tape.jobs].[id] = [job_id]) as JobName,
 (SELECT [name]
   FROM [VeeamBackup].[dbo].[BackupRepositories] WHERE [VeeamBackup].[dbo].[BackupRepositories].id = [linked_backup_repository_id]) as RepositoryName
FROM [VeeamBackup].[dbo].[LinkedBackupRepositories]
Repositories not linked to a tape job

Code: Select all

SELECT [id],[name]
FROM [VeeamBackup].[dbo].[BackupRepositories]
WHERE [VeeamBackup].[dbo].[BackupRepositories].[id] 
NOT IN (select distinct [VeeamBackup].[dbo].[LinkedBackupRepositories].[linked_backup_repository_id] from [VeeamBackup].[dbo].[LinkedBackupRepositories])
Avshalom
Influencer
Posts: 18
Liked: never
Joined: Mar 30, 2014 8:00 am
Full Name: Avshalom
Contact:

Re: Get Repositories by Tape Jobs

Post by Avshalom »

Hello tdewin,

I Haven't tried that yet, but thanks for your reply, i will update you soon if it's done the job..

cheers :)
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get Repositories by Tape Jobs

Post by veremin »

It's not possible at the moment to get source settings of tape job via PowerShell. According to the plan, it should be addressed in the next product version. Thanks.
Avshalom
Influencer
Posts: 18
Liked: never
Joined: Mar 30, 2014 8:00 am
Full Name: Avshalom
Contact:

Re: Get Repositories by Tape Jobs

Post by Avshalom »

tdewin, thanks it works for me throgh ssms,
good enough solution

v.Eremin thanks for your response, waiting for the next version,
cheers
infraerik
Enthusiast
Posts: 26
Liked: 1 time
Joined: Jul 24, 2019 10:04 am
Contact:

Re: Get Repositories by Tape Jobs

Post by infraerik »

Seeing as we've moved on a few versions, is there an easy way to do this now? Thinking specifically of being able to ask a tape job for it's sources which could be a mix of either jobs or repositories.
oleg.feoktistov
Veeam Software
Posts: 1912
Liked: 635 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get Repositories by Tape Jobs

Post by oleg.feoktistov » 1 person likes this post

Hi,

In the current VBR version you can parse Backup to Tape Job sources, for instance, in the following way:

Code: Select all

Get-VBRTapeJob | where {$_.Type -eq "BackupToTape"} | Select-Object Name, Target, @{n="Source";e={$_.Object.Name}}

Name             Target       Source
----             ------       ------
BACKUP-TO-TAPE-1 MEDIA-POOL-1 {BACKUP-TO-SOBR-01, REP-CONFIG}
BACKUP-TO-TAPE-2 MEDIA-POOL-1 SOBR-01
Sources will be presented as Repositories/Jobs names.

Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests