Below script is using Veeam v12.
I would like to change the existing backup job in terms of proxy and backup repository. In veeam v12, changing the backup repository on the backup job is not supported.
Therefore here is my workaround:
# Connect to the Veeam Backup & Replication server
Connect-VBRServer -Server "VBRServerName"
# Get the backup job you want to clone
$sourceJob = Get-VBRJob -Name "OldJobName"
# Get the new proxy server
$newProxy1 = Get-VBRViProxy -Name "newproxy1"
$newProxy2 = Get-VBRViProxy -Name "newproxy2"
#update proxy
Set-VBRJobProxy -Job $sourceJob -Proxy $newProxy1, $newProxy2
# Specify the name for the cloned job
$clonedJobName = "ClonedJobName"
# Clone the backup job
$clonedJob = Copy-VBRJob -Job $sourceJob -Name $clonedJobName -Repository "NewRepository"
# Save the cloned job
Set-VBRJobOptions -Job $clonedJob
# Disconnect from the Veeam Backup & Replication server
Disconnect-VBRServer
In summary,
- Change new proxy
- Clone a new job
- Change new repository name