PowerShell script exchange
Post Reply
h.amer
Influencer
Posts: 10
Liked: never
Joined: Feb 19, 2021 6:31 am
Full Name: Hazem Amer
Contact:

Need to change Job Backup Repository

Post by h.amer »

I will be thanks If you can support me to change all Jobs Backup Repository without cloning the jobs.
I have both Vmware backup & Windows Agent Backup Jobs.

Another thing to change the description of all Jobs one time

Veeam Version: 10.0.0.4461 P2
HannesK
Product Manager
Posts: 14319
Liked: 2890 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: Need to change Job Backup Repository

Post by HannesK »

Hello,
and welcome to the forum.

To change the backup repository, you need to move the backups first. That's pretty complex with PowerShell (you posted in the PowerShell forum). https://www.veeam.com/kb1729

Are you sure, that you want to solve that problem with PowerShell instead of doing it manually? How many VMs / Jobs / Agents to you have?

Description: post289260.html#p289260 should help.

Best regards,
Hannes
h.amer
Influencer
Posts: 10
Liked: never
Joined: Feb 19, 2021 6:31 am
Full Name: Hazem Amer
Contact:

Re: Need to change Job Backup Repository

Post by h.amer »

I know, already all backups moved to the new storage location. I need now just to change the value of the backup repository for each job.
For example old ip 1.1.1.1 and new is 2.2.2.2 and to change description for all
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Need to change Job Backup Repository

Post by oleg.feoktistov »

Hi Hazem,

Which job types do you mean? The ways to set this may vary depending on the job type.

Thanks,
Oleg
h.amer
Influencer
Posts: 10
Liked: never
Joined: Feb 19, 2021 6:31 am
Full Name: Hazem Amer
Contact:

Re: Need to change Job Backup Repository

Post by h.amer »

I have 2 types of backup jobs
1- Vmware backup
2- Windows Agent Backup

I need to change backup repository name and description for each job (I already moved backup files to the new repository)
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Need to change Job Backup Repository

Post by oleg.feoktistov »

For Vmware backup job - there is no direct way to do that, but see the method suggested in this thread.

For Windows agent backup job - it's quite simple if it comes to windows agent jobs managed by VBR:

Code: Select all

$repo = Get-VBRBackupRepository -Name 'Backup Repo'
$job = Get-VBRComputerBackupJob -Name ' Windows Agent Job'
Set-VBRComputerBackupJob -Job $job -Description "Description here" -BackupRepository $repo 
Thanks,
Oleg
h.amer
Influencer
Posts: 10
Liked: never
Joined: Feb 19, 2021 6:31 am
Full Name: Hazem Amer
Contact:

Re: Need to change Job Backup Repository

Post by h.amer »

And if i need do it for all one time,
Can you help me in this?
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Need to change Job Backup Repository

Post by oleg.feoktistov »

Sure, just loop over each job and perform necessary actions.
For VMware backup jobs:

Code: Select all

$repository = Get-VBRBackupRepository "Backup Repo"
$jobs = Get-VBRJob | where {$_.TypeToString -eq "VMware Backup"}
foreach ($job in $jobs) {
   Copy-VBRJob -Job $job -Repository $repository -Description "Description here"
}
For Windows agent backup jobs:

Code: Select all

$repo = Get-VBRBackupRepository -Name "Backup Repo"
$jobs = Get-VBRComputerBackupJob | where {$_.OSPlatform -eq "Windows"}
foreach ($job in $jobs) {
     Set-VBRComputerBackupJob -Job $job -Description "Description here" -BackupRepository $repo 
}
And if you want custom description for each job, you'll need to compose a txt file with an array of description strings, get contents of this file and then match them with a job by index in a nested loop.

Thanks,
Oleg
h.amer
Influencer
Posts: 10
Liked: never
Joined: Feb 19, 2021 6:31 am
Full Name: Hazem Amer
Contact:

Re: Need to change Job Backup Repository

Post by h.amer »

Thanks for your attention and support.
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests