PowerShell script exchange
Post Reply
mkorthuis
Lurker
Posts: 2
Liked: never
Joined: Jun 28, 2022 11:28 am
Full Name: Michael Korthuis
Contact:

use powershell to get backup copy job restore points

Post by mkorthuis »

I am trying to write a powershell script to automate the restoring of hyperv vm's from backup copy jobs that copy backups from our primary site to our secondary site.
my issue is when i issue a get-vbrrestorepoint against a backup copy job I do not get any results. If i issue the same command against a backup job all works as expected. I opened a support case #05502592 and they suggested using (get-vbrbackup -name "backup-copy-job-name").getallstorages(). this does not work either against backup copy jobs but does work with normal backup jobs.
My question is how do I get a list of restore points from by backup copy jobs so i can do restores from by secondary location where the backup copy job data resides?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: use powershell to get backup copy job restore points

Post by oleg.feoktistov »

Hi Michael,

I reviewed your case and assume $backup.GetAllStorages() didn't work as you use backup copy job in immediate mode. It presents some architectural differences vs. periodic mode, so you need to get child backups first. Then, for logical units and further restore you can get a list of restore points:

Code: Select all

$backup = Get-VBRBackup -Name 'Backup Copy Job'
$childBackups = $backup.FindChildBackups()
Get-VRBRestorePoint -Backup $childBackups
For physical units you can then get a list of storages as in the screenshot in your support case:

Code: Select all

$backup = Get-VBRBackup -Name 'Backup Copy Job'
$childBackups = $backup.FindChildBackups()
foreach ($child in $childBackups) {
  $child.GetAllStorages()
}
Best regards,
Oleg
mkorthuis
Lurker
Posts: 2
Liked: never
Joined: Jun 28, 2022 11:28 am
Full Name: Michael Korthuis
Contact:

Re: use powershell to get backup copy job restore points

Post by mkorthuis »

worked as suggested. Thank you.
HannesK
Product Manager
Posts: 14322
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: use powershell to get backup copy job restore points

Post by HannesK »

Hello,
update on this topic... with 12.1.1.56 it's easier. The FindChildBackups is not needed anymore

This is a simple example code:

Code: Select all

$backup = Get-VBRBackup -Name "BCJ-nano-xfs"
$restorepoint = Get-VBRRestorePoint -Backup $backup | Sort-Object –Property CreationTime | Select -Last 1
$targetServerName = "scanserver"
$targetAdminCreds = Get-VBRCredentials -name "lab\dpapi"
Publish-VBRBackupContent -RestorePoint $restorepoint -TargetServerName $targetServerName -TargetServerCredentials $targetAdminCreds
Best regards,
Hannes
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests