PowerShell script exchange
Post Reply
Gve
Service Provider
Posts: 33
Liked: 2 times
Joined: Apr 28, 2015 3:28 pm
Full Name: Guillaume
Location: France
Contact:

Modify Backup Copy Job

Post by Gve »

Hello
I would like to modify the source objects of an existing Backup Copy job
Actualy the job Contain : VM1, VM2
I would like to replace it directy by the Job "Backup Job VM"
The "Backup Job VM" contain the same VM but only with DATA disk :)

In PowerShell i'm able to suppress VM1 and VM2 but i don't be able to add the backup job (in order to link the job)

It's very important for me to modify and not delete the existing job, because there are a lot of data already sent.

Thanks.
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Modify Backup Copy Job

Post by veremin »

Before we actually proceed to scripting, can you elaborate on what you're trying to achieve? You have already created a backup copy job, selecting as its source backup job that processes only OS disks of VM1 and VM2. Now you want to replace the source job with the different backup job that process only DATA disks of the given VMs. If so, what is the idea behind having only part of VMs copied to secondary location, not the VMs as a whole? Thanks.
Gve
Service Provider
Posts: 33
Liked: 2 times
Joined: Apr 28, 2015 3:28 pm
Full Name: Guillaume
Location: France
Contact:

Re: Modify Backup Copy Job

Post by Gve »

I want to modify backup scénario of one hundred clients. Backup copy of OS disk (to a VCP) is too bandwidth consumer (80% of daily increment is on OS disk !!) , so i want to remove only OS disk from backup copy.
To do that, i remove the OS disk from existing backup Job, an I create a new job with only OS disk
consequently i Have 2 Jobs
Backup Job OS
Backup Job DATA

I Have a "Backup COPY Job" with "VM1"
I would like to modify the "Backup Copy Job" in order to only send the DATA disk of VM. By replacing Source Object "VM1" by "Backup Job DATA"

If I delete and recreate the backup Copy Job with good Object (the DATA job and not the VM), i m not be able to remap backup on existing Cloud File by powershell :(, so i need to re send the complete DataDisk to the Cloud.
I must to do that remotely, i have remote Tools for executing PowerShell on clients serveurs.
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Modify Backup Copy Job

Post by veremin »

Currently, there is no way to add job objects to backup copy job via PowerShell - it's only possible during job creation (Add-VBRViBackupCopyJob). At least not something I'm aware of.

So, I think you'll have to delete existing jobs, re-create them via PS and let them finish their initial cycle.

Thanks.
Gve
Service Provider
Posts: 33
Liked: 2 times
Joined: Apr 28, 2015 3:28 pm
Full Name: Guillaume
Location: France
Contact:

Re: Modify Backup Copy Job

Post by Gve »

Average intial cycle is 4 weeks...

If i keep the backup copy job with 'VM1" when the backup Copy start, it select the last restore point of VM1 by checking in all jobs ?
So if the Data disk Job is the last executed job, the backup copy select it ?
Si its ok ?
:)
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Modify Backup Copy Job

Post by veremin »

So if the Data disk Job is the last executed job, the backup copy select it ?
Correct. A backup copy job will copy the result of the latest executed job. Thanks.
AlexL
Service Provider
Posts: 105
Liked: 7 times
Joined: Aug 24, 2010 8:55 am
Full Name: Alex
Contact:

Re: Modify Backup Copy Job

Post by AlexL »

It would be very nice to have this in powershell. In large environments it is often not feasable to create a new job and reapply each and every setting. Please add this to the wish list for a next release.

v.Eremin wrote:Currently, there is no way to add job objects to backup job via PowerShell - it's only possible during job creation (Add-VBRViBackupCopyJob). At least not something I'm aware of.

So, I think you'll have to delete existing jobs, re-create them via PS and let them finish their initial cycle.

Thanks.
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Modify Backup Copy Job

Post by veremin » 1 person likes this post

Your request has been counted. We'll definitely think about what can be done in this regard in one of the next product releases. Thanks.
victor.bylin@atea.se
Service Provider
Posts: 47
Liked: 2 times
Joined: Oct 26, 2017 11:22 am
Full Name: Victor
Contact:

Re: Modify Backup Copy Job

Post by victor.bylin@atea.se »

Hi,

Reusing this thread, I can't se that this is possible today.
That I would like to do is add a backup job to an active BackupCopy job with powershell.

Is that the case that it is not possible still?


Thanks :)
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Modify Backup Copy Job

Post by veremin »

The situation is still the same, as we've had to concentrate on other pending PS requirements (that had higher priority). Thanks.
Lucas_H
Influencer
Posts: 17
Liked: 4 times
Joined: Nov 16, 2018 3:14 pm
Full Name: Lucas HELLMANN
Location: Lyon, FRANCE
Contact:

[MERGED] Configure secondary destinations for a new job

Post by Lucas_H »

Hello,

I would like to know if there is a way in Powershell to configure secondary destinations for a new Job ?
I looked into the various options but couldn't find one for this. We already have some Copy Job running and I would like to link newly created backup Job to it.

My script to create new Job looks like this so far :

$VMNAME = "CLIENTVMNAME"
$JobClient = "JOBCLIENTNAME"
$ClientVirtualmachine = Get-VBRServer -Type hvcluster -name "MYCLUSTER" | Find-VBRHvEntity -Name "$VMNAME"
$repository = Get-VBRBackupRepository -Name REPOSITORY
$options = New-VBRJobOptions -ForBackupJob
$options.HvSourceOptions.EnableHvQuiescence = $True
$options.HvSourceOptions.CanDoCrashConsistent = $True
$options.HvSourceOptions.OffHostBackup = $False
$options.HvSourceOptions.GroupSnapshotProcessing = $False
$options.BackupStorageOptions.StgBlockSize = "KbBlockSize4096"
$options.BackupStorageOptions.EnableDeduplication = $False
Add-VBRHvBackupJob -Name $JobClient -Entity $ClientVirtualmachine -BackupRepository $repository -Description "backup for $vm"
Set-VBRJobOptions -Job $JobClient -Options $options | Out-Null


I get all the other options I want but I found nothing relating to secondary destinations. Any tips on how to get this done appreciated.
Thanks, Lucas.
nielsengelen
Product Manager
Posts: 5797
Liked: 1215 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Configure secondary destinations for a new job

Post by nielsengelen »

You can leverage backup copy jobs powershell cmdlets for this based on your backup jobs. Have a look at the userguide.
Personal blog: https://foonet.be
GitHub: https://github.com/nielsengelen
Lucas_H
Influencer
Posts: 17
Liked: 4 times
Joined: Nov 16, 2018 3:14 pm
Full Name: Lucas HELLMANN
Location: Lyon, FRANCE
Contact:

Re: Configure secondary destinations for a new job

Post by Lucas_H »

Hey,

Thanks for the fast reply, but I don't want to create a new backup copy Jobs.
I would like to add a new backup job to an existing backup copy job. Is that possible through powershell commands ?
Alex Uryumtsev
Enthusiast
Posts: 51
Liked: 7 times
Joined: Oct 29, 2018 9:56 am
Full Name: Alexander Uryumtsev
Contact:

Re: Configure secondary destinations for a new job

Post by Alex Uryumtsev »

Hi currently it is impossible, please refer to this thread.

BR,
Alex
Lucas_H
Influencer
Posts: 17
Liked: 4 times
Joined: Nov 16, 2018 3:14 pm
Full Name: Lucas HELLMANN
Location: Lyon, FRANCE
Contact:

Re: Configure secondary destinations for a new job

Post by Lucas_H »

Hi,

Oh ok, thanks for the info, I'll try another way then.

As I'm working with an Hyper-V infrastructure, I managed to directly add VM into Backup copy job, so I'll think I'll do it like this :

Code: Select all

$vm = Get-VBRServer -Type hvcluster -name "MyCluster" | Find-VBRHvEntity -Name "VMName"
Add-VBRHvJobObject -Job BACKUPCOPYJOB -Entities $vm

Best regards,
Lucas
veremin
Product Manager
Posts: 20413
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Modify Backup Copy Job

Post by veremin »

Correct, adding VM objects (instead of job ones) to backup copy job should work without any issues. Thanks!
mdiver
Veeam Legend
Posts: 230
Liked: 37 times
Joined: Nov 04, 2009 2:08 pm
Contact:

Re: Modify Backup Copy Job

Post by mdiver »

Any news here already?

We also want to add backup jobs into pre-existing backup copy jobs.
This is in a larger customer environment. Backup copy jobs also are member of tape jobs. So a re-creation always messes up the whole environment.

Is there maybe an unsupported way to achieve that? The API for agent jobs already is capable of doing it.
Help here would be greatly appreciated.

Thanks,
Mike
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Modify Backup Copy Job

Post by oleg.feoktistov » 1 person likes this post

Yes, we are planning to get there with regular backup copy jobs in one of the next production versions. I wouldn't wait for it any time soon though as it requires a whole new set of cmdlets for both backup jobs and backup copy jobs.
There is an unsupported way to set it through .NET static methods actually:

Code: Select all

$jobToAdd = Get-VBRJob -Name 'Job to Add'
$copyjob = Get-VBRJob -Name 'Backup Copy Job 1'
$randomGuid = New-Guid
$linkedObjectInfo = [Veeam.Backup.Model.CLinkedObjectInfo]::new($randomGuid, $copyjob.Id, $jobToAdd.Id, (Get-Date), 0)
$linkedJob = [Veeam.Backup.Core.CLinkedJobs]::Create($linkedObjectInfo)
$copyjob.Update() 
Note though that this way we also generate a random guid to compose a new CLinkedObjectInfo instance and write it to our database.
Adding it like that works, but I cannot guarantee it will all work correctly as soon as you start your jobs. So, most likely, I wouldn't use it in a production environment. Hence, please, be very cautious and test it before going anywhere further with it.

Thanks,
Oleg
mdiver
Veeam Legend
Posts: 230
Liked: 37 times
Joined: Nov 04, 2009 2:08 pm
Contact:

Re: Modify Backup Copy Job

Post by mdiver »

I works like a charm. Thanks, Oleg.
We even use it productively now after an open discussion with the customer on the risks.
So it would be great to have this functionality with full support in an upcoming release.

Regards,
Mike
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Modify Backup Copy Job

Post by oleg.feoktistov »

Yep, I agree. A lot of work with it though, definitely not for vNext. Thanks!
AlexL
Service Provider
Posts: 105
Liked: 7 times
Joined: Aug 24, 2010 8:55 am
Full Name: Alex
Contact:

Re: Modify Backup Copy Job

Post by AlexL »

Also still waiting for this since 2016, been doing it manually for every new customer job since, will check out the unsupported .net code, thanks for posting!
RubinCompServ
Service Provider
Posts: 326
Liked: 78 times
Joined: Mar 16, 2015 4:00 pm
Full Name: David Rubin
Contact:

Re: Modify Backup Copy Job

Post by RubinCompServ »

oleg.feoktistov wrote: Jun 17, 2021 4:58 pm Yes, we are planning to get there with regular backup copy jobs in one of the next production versions. I wouldn't wait for it any time soon though as it requires a whole new set of cmdlets for both backup jobs and backup copy jobs.
There is an unsupported way to set it through .NET static methods actually:

Code: Select all

$jobToAdd = Get-VBRJob -Name 'Job to Add'
$copyjob = Get-VBRJob -Name 'Backup Copy Job 1'
$randomGuid = New-Guid
$linkedObjectInfo = [Veeam.Backup.Model.CLinkedObjectInfo]::new($randomGuid, $copyjob.Id, $jobToAdd.Id, (Get-Date), 0)
$linkedJob = [Veeam.Backup.Core.CLinkedJobs]::Create($linkedObjectInfo)
$copyjob.Update() 
Note though that this way we also generate a random guid to compose a new CLinkedObjectInfo instance and write it to our database.
Adding it like that works, but I cannot guarantee it will all work correctly as soon as you start your jobs. So, most likely, I wouldn't use it in a production environment. Hence, please, be very cautious and test it before going anywhere further with it.

Thanks,
Oleg

Following up on this with v11a. To quote my kids, "Are we there yet?" If not, is it something that will be in v12? Or is it still somewhere in v12++?
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Modify Backup Copy Job

Post by oleg.feoktistov » 1 person likes this post

Hi David,

In v12 backup copy jobs become multiplatform. With this new format we also plan to add new cmdlets in v12.
The whole set of options including adding source backup jobs to an existing backup copy will be available there.
So, yes, we are getting there. At least, with backup copy jobs.

Best regards,
Oleg
Gunnersaurus
Service Provider
Posts: 77
Liked: 6 times
Joined: Aug 31, 2015 8:20 pm
Contact:

Re: Modify Backup Copy Job

Post by Gunnersaurus »

Another follow up now that we are at v12.1 release. Is this a thing yet?
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Modify Backup Copy Job

Post by oleg.feoktistov »

Hi,

It's a thing for backup copy jobs since v12. See these cmdlets.

Thanks,
Oleg
Gunnersaurus
Service Provider
Posts: 77
Liked: 6 times
Joined: Aug 31, 2015 8:20 pm
Contact:

Re: Modify Backup Copy Job

Post by Gunnersaurus »

Great news thanks Oleg!
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests