-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Filter Jobs by # of Objects
I have upgraded to Veeam 9 and now need to run Active Full backups for the Per-VM settings in my repositories. I want to do this via Powershell but want to filter the jobs based on Object count.
So anything greater than 1 (multiple VMs in a job) and then run Full Backup to create the new per VM VBK files. I am doing this manually now but a script would be better.
Anyone have an idea? I just need to know mainly the variable for Object.
So anything greater than 1 (multiple VMs in a job) and then run Full Backup to create the new per VM VBK files. I am doing this manually now but a script would be better.
Anyone have an idea? I just need to know mainly the variable for Object.
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Veeam Software
- Posts: 649
- Liked: 170 times
- Joined: Dec 10, 2012 8:44 am
- Full Name: Nikita Efes
- Contact:
Re: Filter Jobs by # of Objects
You can use Get-VBRJobObject to find objects in job.
Also make sure you don't just check the number of objects, if you use containers (so jobs with 1 host certainly do require enabling this option, while job with 1 vm does not).
Also make sure you don't just check the number of objects, if you use containers (so jobs with 1 host certainly do require enabling this option, while job with 1 vm does not).
-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Re: Filter Jobs by # of Objects
Thanks. So how would you filter by jobs that have more than 1 object (>1)?
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Veeam Software
- Posts: 649
- Liked: 170 times
- Joined: Dec 10, 2012 8:44 am
- Full Name: Nikita Efes
- Contact:
Re: Filter Jobs by # of Objects
I suppose, that you can skip all jobs, where number of objects is 1 and $object.Object.type property is "VM".
-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Re: Filter Jobs by # of Objects
Yes that would work. So what is the variable for Objects? So that I can say either -ne 1 and skip.
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Veeam Software
- Posts: 649
- Liked: 170 times
- Joined: Dec 10, 2012 8:44 am
- Full Name: Nikita Efes
- Contact:
Re: Filter Jobs by # of Objects
As I said, it can be obtained from Get-VBRJobObject command, like:
//fixed couple missprints
Code: Select all
$jobs = Get-VBRJob
foreach ($job in $jobs)
{
$Object = Get-VBRJobObject -Job $job
if (($Object.length -eq 1) -and ($Object.Object.Type -eq "VM")) { #skip this job, it contains 1 VM}
else {#run active full}
}
-
- Product Manager
- Posts: 20411
- Liked: 2300 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Filter Jobs by # of Objects
Just want to double-check whether you're aware that per-vm chain is the setting of a backup repository, not of a backup job. So, each job pointed to the repository with per-VM chain enabled will be using this setting, and you cannot filter our one job or another.
So, wouldn't it be easier just assign to a variable names of repositories the said setting should be enabled on, and then enable the said check-box.
Thanks.
So, wouldn't it be easier just assign to a variable names of repositories the said setting should be enabled on, and then enable the said check-box.
Thanks.
-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Re: Filter Jobs by # of Objects
Yes I am aware of that but just needed something to run the Active Full jobs since you need to do this once the Per-VM is turned on.v.Eremin wrote:Just want to double-check whether you're aware that per-vm chain is the setting of a backup repository, not of a backup job. So, each job pointed to the repository with per-VM chain enabled will be using this setting, and you cannot filter our one job or another.
So, wouldn't it be easier just assign to a variable names of repositories the said setting should be enabled on, and then enable the said check-box.
Thanks.
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Product Manager
- Posts: 20411
- Liked: 2300 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Filter Jobs by # of Objects
Is it only one repository? If so, use the following script, it should initiate a full backup cycle for every backup job pointed to repository with predefined name.
Thanks.
Code: Select all
asnp VeeamPSSNapin
foreach ($Job in (Get-VBRJob | where {$_.JobType -eq "Backup" -and $_.FindTargetRepository().name -eq "Name of your Repository"}))
{
$Job | Start-VBRJob -FullBackup
}
-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Re: Filter Jobs by # of Objects
Thanks for that as it seems much simpler. For the name of the repository can I string together multiples with commas? Like - $_.FindTargetRepository().name -eq "RepoA,RepoB,RepoC"}
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Product Manager
- Posts: 20411
- Liked: 2300 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Filter Jobs by # of Objects
Updated version where you can specify names of multiple repositories. Also, this script filters out jobs having only one source object:
Code: Select all
asnp VeeamPSSNapin
$RepositoryList = "Name of first Repository", "Name of second Repository"
foreach ($Repository in (Get-VBRBackupRepository -Name $RepositoryList))
{
foreach ($Job in (Get-VBRJob | where {$_.JobType -eq "Backup" -and $_.FindTargetRepository().name -eq $Repository.name -and $_.GetObjectsInJob().count -gt 1}))
{
$Job | Start-VBRJob -FullBackup
}
}
-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Re: Filter Jobs by # of Objects
Thanks allot for this. Maybe we can make this a sticky like the one to turn on BitLooker to make things easier for users to run a Full Backup to take advantage of Per-VM Repository settings. I know the scheduled Full does not do it or until a patch comes out.
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
-
- Product Manager
- Posts: 20411
- Liked: 2300 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Filter Jobs by # of Objects
I'm already thinking about that. I might add several lines to it, so that, it gets list of repositories with per-VM chain enabled automatically, instead of waiting for it to be filled manually. Thanks.
-
- Product Manager
- Posts: 20411
- Liked: 2300 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Filter Jobs by # of Objects
Done. Though, I've decided to remove the line filtering jobs with one VM (as I find it rather isolated case). Thanks.
-
- Veeam Vanguard
- Posts: 636
- Liked: 154 times
- Joined: Aug 13, 2014 6:03 pm
- Full Name: Chris Childerhose
- Location: Toronto, ON
- Contact:
Re: Filter Jobs by # of Objects
Very nice!! Yeah I just didn't want to run Full backup for a 1 VM job as that is a moot point since Per-VM does not technically apply. Glad to have help create another sticky.v.Eremin wrote:Done. Though, I've decided to remove the line filtering jobs with one VM (as I find it rather isolated case). Thanks.
-----------------------
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Chris Childerhose
Veeam Vanguard / Veeam Legend / Veeam Ceritified Architect / VMCE
vExpert / VCAP-DCA / VCP8 / MCITP
Personal blog: https://just-virtualization.tech
Twitter: @cchilderhose
Who is online
Users browsing this forum: No registered users and 9 guests