PowerShell script exchange
Post Reply
filipsmeets
Enthusiast
Posts: 37
Liked: 3 times
Joined: Jun 26, 2019 3:28 pm
Full Name: Filip Smeets
Contact:

Add-VBREpBackupCopyJob

Post by filipsmeets »

I have scripted the creation of my Veeam Agent backups based on protection groups (Clusters) and now also want to add the creation of the Backup Copy job.

This is what I tried:
Add-VBREPBackupCopyJob -Backup $EPbackup -DirectOperation -Name ($Jname + "-copy") -Description $Copydescr -Repository $CopyRepo

But I cannot find my Veeam Agent Backup job using the following:
$EPbackup = Get-VBRBackup -Name $JnameMX (only shows me backups that have already run.)
or
$EPbackup = Get-VBRBackup -Name $JnameMX
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Add-VBREpBackupCopyJob

Post by oleg.feoktistov »

Hi Filip,

To retrieve agent backup job and then use it as a source for backup copy try this method instead:

Code: Select all

$EPBackupJob = Get-VBREPJob -Name 'JobName'
Add-VBREpBackupCopyJob -BackupJob $EPBackupJob -DirectOperation -Name ($Jname + "-copy") -Description $Copydescr -Repository $CopyRepo
Best regards,
Oleg
veremin
Product Manager
Posts: 20411
Liked: 2300 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Add-VBREpBackupCopyJob

Post by veremin »

Small clarification - if you want to add backup copy job for backups created by agent management backup policy, you should try Add-VBRComputerBackupCopyJob cmdlet, because the Add-VBREPBackupCopyJob is an old cmdlet that works mostly for standalone agents only. Thanks!
filipsmeets
Enthusiast
Posts: 37
Liked: 3 times
Joined: Jun 26, 2019 3:28 pm
Full Name: Filip Smeets
Contact:

Re: Add-VBREpBackupCopyJob

Post by filipsmeets »

Hi Oleg

Get-VBREPJob returns nothing.

Add-VBRComputerBackupCopyJob doesn't work either as it only accepts CBackup[] objects. To get that object, I need to run Get-VBRBackup and that only returns Backup jobs that have already created backups. As my agent backup job, also created with the script, hasn't run yet, this command also returns nothing.

Small remarkt here. We are running version 9.5. No plans yet to migrate to v10.
veremin
Product Manager
Posts: 20411
Liked: 2300 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Add-VBREpBackupCopyJob

Post by veremin »

Add-VBRComputerBackupCopyJob accepts both backup and job objects, but the cmdlet was implemented in version 10 - no idea how you were able to access it in 9.5.

Anyway, additional reason to update to the latest product version.

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests