You have 70 File Share backup jobs in Veeam, and you want to change their repository destination (all to a new repo) in one go without manually editing every job.
This can’t be done from the GUI in one click, but you can automate it using PowerShell with Veeam’s snap-in.
can one assistance for code
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Oct 22, 2023 8:08 am
- Full Name: Ahmed Hasan Salman
- Contact:
-
- Veeam Software
- Posts: 2931
- Liked: 674 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: change repo by Power Shell
Hi Ahmed.albatoosh,
Sure, the following code is pseudo-code, but should be all you need:
cmdlets:
Get-VBRUnstructuredBackupJob
Get-VBRUnstructuredBackup
Detach-VBRBackup
Set-VBRNasBackupJob
Basic workflow would be:
Note this is very basic structure of the code and will point all jobs to the repo you assign to variable $newRepo -- if you need to point to different repositories depending on the job, you will need to write your own logic to determine that.
Sure, the following code is pseudo-code, but should be all you need:
cmdlets:
Get-VBRUnstructuredBackupJob
Get-VBRUnstructuredBackup
Detach-VBRBackup
Set-VBRNasBackupJob
Basic workflow would be:
Code: Select all
$uJob = Get-VBRUnstructuredBackupJob #Fetches all Unstructured backup jobs, probably you will want to filter this somehow
$newRepo = Get-VBRBackupRepository -Name "Name of new Repository"
Foreach($u in $uJob){
$uBackup = Get-VBRUnstructuredBackup | Where-Object {$_.JobId -eq $u.id}
Detach-VBRBackup -Backup $uBackup
Set-VBRNasBackupJob -Job $u -ShortTermBackupRepository $newRepo
Delete-Variable ubackup
}
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 1 guest