Veeam PowerShell cmdlets to help Automate Backup Copy Backup Format Upgrade

KB ID: 4387
Product: Veeam Backup & Replication | 12
Published: 2023-02-15
Last Modified: 2023-03-14
Get weekly article updates
By subscribing, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.

Cheers for trusting us with the spot in your mailbox!

Now you’re less likely to miss what’s been brewing in our knowledge base with this weekly digest

error icon

Oops! Something went wrong.

Please try again later.

Purpose

This article provides information about using Veeam PowerShell to automate the procedure of upgrading Legacy Periodic Backup Copy jobs to use the new True Per-Machine backup format.

These PowerShell commands can be used to simplify the Backup Chain Format upgrade process

Solution

PowerShell Commands

Upgrade-VBRBackup

This cmdlet upgrades the backup chain format of backups from per-machine (split machine) to true per-machine. Note that the cmdlet does not upgrade single storage backups.

If you want to change the backup chain format for other backups, you need to use the Detach-VBRBackup cmdlet to detach backups from the job. Ensure that the job is targeted to the repository that creates backups of the required backup chain format. Then launch the job. For more information on backup chain formats and how to change them, see the Changing Backup Chain Formats section in Veeam Backup & Replication User Guide.
 

Convert-VBRLegacyCopyBackup

This cmdlet converts the legacy backup file of the legacy periodic backup copy job to the true per-machine backup file using mapping.

The cmdlet detaches the backup chain from the legacy periodic backup copy job, resynthesizes a new backup, and then links the resynthesized backup to a new backup copy job. After you run the cmdlet, you will have two sets of backups: a set containing detached legacy backups and a true per-machine backup set linked to the new backup copy job.

 

Script Example

The following PowerShell script is provided as an example of how the Upgrade-VBRBackup and Convert-VBRLegacyCopyBackup cmdlets can be used in conjunction with other Veeam PowerShell commands to simplify the Backup Chain Format upgrade process.

This example script is provided as-is without guaranteeing it can account for every configuration.

Note: The Source Legacy Backup Copy Job must be disabled before executing this script.

#Specify Legacy Periodic Backup Copy Job Name
$jobNameToUpgrade = "LegacyCopyJobName"
#Do Not Edit Below This Line
$jobsToUpgrade = get-vbrjob -Name $jobNameToUpgrade 
$repos = Get-VBRBackupRepository
$scaleOutRepos = Get-VBRBackupRepository -ScaleOut
foreach ($jobToUpgrade in $jobsToUpgrade)
{
    $sources = Get-VBRLegacyBackupCopySourceJob -job $jobToUpgrade 
       if ($sources -eq $null) 
    {
       write-host ("Backup copy job "+$jobToUpgrade.name+" doesn't have backup jobs as sources")
    } 
       else 
       { 
             Disable-VBRjob -Job $jobToUpgrade
              $repo = $repos | where {$_.Id -eq $jobToUpgrade.TargetRepositoryId}
              if ($repo -eq  $null) {
                $repo = $scaleOutRepos | where {$_.Id -eq $jobToUpgrade.TargetRepositoryId}
              }
              $newJobName = ($jobToUpgrade.name + "_Upgraded")
              $backupToUpgrade = Get-VBRBackup | where JobId -eq $jobToUpgrade.Id
              $sourceJobName = $sources.name 
              $sourceBackups = Get-VBRBackup -name $sourceJobName
              foreach ($sourceBackup in $sourceBackups) 
              {
                     if ($sourceBackup.istruepervmcontainer -eq $True)
                  {
                           write-host ("Backup "+$sourceJobName+" is already upgraded")
                  }
                     else 
                     {
                           Upgrade-VBRBackup -Backup $sourceBackup -Force
                  }
              } 
              $newBackupCopyJob = Add-VBRBackupCopyJob -Name $newJobName -Mode Immediate -BackupJob $sources -TargetRepository $repo -DirectOperation 
              Convert-VBRLegacyCopyBackup -Backup $backupToUpgrade -TargetJob $newBackupCopyJob 
       }
} 
To submit feedback regarding this article, please click this link: Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.

Spelling error in text

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

Oops! Something went wrong.

Please try again later.

KB Feedback/Suggestion

This form is only for KB Feedback/Suggestions, if you need help with the software open a support case

By submitting, you are agreeing to have your personal information managed in accordance with the terms of Veeam's Privacy Notice.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Verify your email to continue your product download
We've sent a verification code to:
  • Incorrect verification code. Please try again.
An email with a verification code was just sent to
Didn't receive the code? Click to resend in sec
Didn't receive the code? Click to resend
Thank you!

Thank you!

Your feedback has been received and will be reviewed.

error icon

Oops! Something went wrong.

Please try again later.