PowerShell script exchange
Post Reply
marius roma
Veteran
Posts: 459
Liked: 5 times
Joined: Feb 01, 2012 12:04 pm
Full Name: Mario
Contact:

List backup jobs, reposotory and folder names

Post by marius roma »

I apologize for the very basic question.
I need to list existing backup jobs and, for each job, the related repository and the name of the folder
Something like:

bckjob001 Bckstorage1 \\storage1\veeam\bckjob001
bckjob002 Bckstorage1 \\storage1\veeam\backup_job_2
bckjob003 Bckstorage2 \\storage2\backup\veeam\bck_job_3_new

and so on.
As you can see, folder names can be different from job names.
Can anybody please help?
regards
Marius
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List backup jobs, reposotory and folder names

Post by veremin » 1 person likes this post

Hi, Marius,

Try the following one-liner:

Code: Select all

Get-VBRJob | where {$_.JobType -eq "Backup"} | select @{N="Name";E={$_.Name}}, @{N="Repository Name";E={$_.GetTargetRepository().name}}, @{N="Repository Path";E={$_.GetTargetRepository().Path}}| ft -AutoSize
Thanks.
marius roma
Veteran
Posts: 459
Liked: 5 times
Joined: Feb 01, 2012 12:04 pm
Full Name: Mario
Contact:

Re: List backup jobs, reposotory and folder names

Post by marius roma »

Many, many thanks.
Let me ask for a further help.
Is it possible to get the full folder name as well?
Let me explain: if I create a job whose name is "Backup_job_001" the files are saved in a folder whose name is "\\storage1\veeam\Backup_job_001".
If for any reason I rename the job so that the new name is "Backup_job_Finance" I will have a job whose name is ""Backup_job_Finance" writing on folder "\\storage1\veeam\Backup_job_001".
Is is possible to ghet the full folder name, in the example "\\storage1\veeam\Backup_job_001"?
Regards
marius
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List backup jobs, reposotory and folder names

Post by veremin » 1 person likes this post

Just combine a name with a repository path, and you're good to go:

Code: Select all

Get-VBRJob | where {$_.JobType -eq "Backup"} | select @{N="Name";E={$_.Name}}, @{N="Repository Name";E={$_.GetTargetRepository().name}}, @{N="Full Path";E={$_.GetTargetRepository().Path + "\" + $_.Name}} | ft -AutoSize
Thanks.
marius roma
Veteran
Posts: 459
Liked: 5 times
Joined: Feb 01, 2012 12:04 pm
Full Name: Mario
Contact:

Re: List backup jobs, reposotory and folder names

Post by marius roma »

Thank you for your message.
The problem is that the path can be different from the job name, so job "Backup_job_Finance" cam write in folder "\\storage1\veeam\Backup_job_001".
Is there any way to get the real folder name?
Regards
marius
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: List backup jobs, reposotory and folder names

Post by veremin »

Hmm, in this case I think that querying file system, using Get-Item cmdlet is the only option.

The algorithm should be as follows:

1) Find the latest backup for a given backup job.
2) Get its name.
3) Pass a repository directory as well as backup name to Get-Item cmdlet (don't forget to leverage -recurse switch)
4) Once the backup file is found by Get-Item, check its parent directory - it will be the exact information you're after.

Thanks.
Backerupper
Enthusiast
Posts: 47
Liked: 24 times
Joined: Dec 28, 2012 2:32 pm
Contact:

Re: List backup jobs, reposotory and folder names

Post by Backerupper »

You could try looking at the backups as opposed to jobs like so:

Code: Select all

Get-VBRBackup | ?{$_.JobType -eq "Backup"} | Select JobName, @{N="Repository Name";E={$_.GetRepositoryName()}}, DirPath
Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests