PowerShell script exchange
Post Reply
DGodwin
Lurker
Posts: 2
Liked: never
Joined: May 21, 2021 8:51 am
Full Name: Duane Godwin
Contact:

Get Backup name when Job name has changed

Post by DGodwin »

I'm trying to do a test restore with PowerShell, and it's working as long as the Backup name is the same as the Job name.

There are several servers where someone has changed the Job name, and the Backup name hasn't changed.

Method:
Get Job names with Get-VBRJob
Randomly select a Job
Get VMs in Job
Randomly select a VM
Do the restore - I need the Backup name for this, and can't match a Backup to a Job if they're different.

Is there a way of figuring out the Backup name that's attached to a Job?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get Backup name when Job name has changed

Post by oleg.feoktistov » 1 person likes this post

Hi Duane and welcome to the forums!

Even if the name has changed, job id stays the same. So just get job id and then filter backups by it:

Code: Select all

$job = Get-VBRJob -Name 'Backup Job'
$backup = Get-VBRBackup | where {$_.JobId -eq $job.Id}
Thanks,
Oleg
DGodwin
Lurker
Posts: 2
Liked: never
Joined: May 21, 2021 8:51 am
Full Name: Duane Godwin
Contact:

Re: Get Backup name when Job name has changed

Post by DGodwin »

Hi Oleg, thanks for the quick and excellent response. This works perfectly.

Just a note from browsing various posts over the last few days - the quality of responses in this forum is outstanding.
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Get Backup name when Job name has changed

Post by oleg.feoktistov » 1 person likes this post

Glad we could help you!
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests