Rotating folders or VM inside a job

PowerShell script exchange

Rotating folders or VM inside a job

Veeam Logoby marius roma » Thu Jan 14, 2016 11:49 am

I have a problem that can look quite complex, but I hope there is a solution.
I have many backup and replica jobs based on the contents of folders.
Imagine I have 4 folders:
- VM Italy
- VM France
- VM Greece
- VM Austria
All the jobs use a time window, so if for any reason the job terminates before completing the contents of the latest folders are not processed.
If the same job fails for two times the contents of the latest folders are skipped, and the VM inside the "VM Austria" folder are not processed twice.
I can solve the problem manually by changing the order of the folders inside the job.
Can I create a script that once a day processes all my jobs and rotate the order in which folders are processed, so that the next time the job is executed the order is:
- VM France
- VM Greece
- VM Austria
- VM Italy
and the following time the order is:
- VM Greece
- VM Austria
- VM Italy
- VM France
and so on?
I understand it is complex, but Powershell is so powerfull...
Regards
marius
marius roma
Expert
 
Posts: 317
Liked: 3 times
Joined: Wed Feb 01, 2012 12:04 pm
Full Name: Mario

Re: Rotating folders or VM inside a job

Veeam Logoby nefes » Thu Jan 14, 2016 2:25 pm

I can see the solution in removing first object from the job and adding it back. This will move it to the end of the list.
Please check this before implementing in production, it was quickly checked on job with 2 VMs.
Code: Select all
$job = Get-VBRJob -Name <name of your job>
$first = (Get-VBRJobObject -Job $job)[0]
$entity = Find-VBRViEntity -Name $first.Name -Server $first.Location.Split('\')[0]
Remove-VBRJobObject -Objects $first
Add-VBRViJobObject -Job $job -Entities $entity
nefes
Veeam Software
 
Posts: 534
Liked: 125 times
Joined: Mon Dec 10, 2012 8:44 am
Full Name: Nikita Efes


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests