-
- Enthusiast
- Posts: 32
- Liked: 4 times
- Joined: Apr 13, 2012 3:51 pm
- Full Name: Neil Colthorpe
- Contact:
Script to list all VMs and which jobs they are in
Pretty much everyday I would use a report which shows all the VMs and which jobs they are in. I could simply do a ctrl + f and instantly see what job a given VM is protected by. This was tackled back in 2012 on these forums but I could not get this to work and it carries other baggage I do not need.
Please could someone give me a Powershell script to pull just this data out?
Please could someone give me a Powershell script to pull just this data out?
-
- Veteran
- Posts: 7328
- Liked: 781 times
- Joined: May 21, 2014 11:03 am
- Full Name: Nikita Shestakov
- Location: Prague
- Contact:
Re: Script to list all VMs and which jobs they are in
Hello Neil,
How about getting the desired info from Protected VMs Veeam ONE report rather than delve into scripts?
Thanks!
How about getting the desired info from Protected VMs Veeam ONE report rather than delve into scripts?
Thanks!
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Script to list all VMs and which jobs they are in
Speaking about the scripts, the following one will list job names along with names of their objects:
However, it might be a better idea to leverage the script provided here.
Thanks.
Code: Select all
Asnp VeeamPssnapin
Foreach ($Job in Get-VBRJob)
{
$Job | select name, {$_.GetObjectsInJob().name} | ft
}
Thanks.
-
- Enthusiast
- Posts: 32
- Liked: 4 times
- Joined: Apr 13, 2012 3:51 pm
- Full Name: Neil Colthorpe
- Contact:
Re: Script to list all VMs and which jobs they are in
Thanks. I've slightly modified the last script, but it shows the folder objects instead of the VMs, and VMs only if they are specified. The Veeam One reporting isn't working for me at the moment, I'll log a call to get that fixed, although that's more long-winded than Powershell which I can schedule with my "backed up by Veeam" script.
Code: Select all
Foreach ($Job in Get-VBRJob)
{
$job | select name
"-------------------"
$Job |select @{Name="Objectsinjob";Expression={$_.GetObjectsInJob().name}} | select -expandproperty Objectsinjob
" "
}
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Script to list all VMs and which jobs they are in
VMs belonging to a specific folder can be gotten via the following one-liner:
Thanks.
Code: Select all
Find-VBRViEntity -VMsAndTemplates -Server (Get-VBRServer -Name "Name of your VC") | where {$_.VmFolderName -eq "Name of your folder"}
-
- Veteran
- Posts: 7328
- Liked: 781 times
- Joined: May 21, 2014 11:03 am
- Full Name: Nikita Shestakov
- Location: Prague
- Contact:
Re: Script to list all VMs and which jobs they are in
Could you specify the problem with Veeam One? Have you contacted Veeam technical support with that?ncolt wrote:The Veeam One reporting isn't working for me at the moment, I'll log a call to get that fixed
Thanks!
-
- Enthusiast
- Posts: 32
- Liked: 4 times
- Joined: Apr 13, 2012 3:51 pm
- Full Name: Neil Colthorpe
- Contact:
Re: Script to list all VMs and which jobs they are in
Could you tell me what the best report in Veeam One is for this? I've tried VM > protected VMs Job Schedule but the Backup Job column is in some kind recurring loop which has nothing to do with the VMs column.
The script is getting there although as it calls PowerCLI get-view for the contents of folders (for speed) it cannot not tell you which VMs are excluded, please could you tell me the Veeam command for that so i can integrated this information e.g. get-vbrjob| select excluded
The script is getting there although as it calls PowerCLI get-view for the contents of folders (for speed) it cannot not tell you which VMs are excluded, please could you tell me the Veeam command for that so i can integrated this information e.g. get-vbrjob| select excluded
Code: Select all
Foreach ($Job in Get-VBRJob)
{
$job | select name
"-------------------"
"Foldername"
$foldername= $Job | select @{Name="Objectsinjob";Expression={$_.GetObjectsInJob().name}} | select -expandproperty objectsinjob
$foldername
" "
$check=get-view -viewtype folder -filter @{"name"="$foldername"}
if ($check)
{
"VMs in folder";
$check.ChildEntity | get-viobjectbyviview | select name
}
" "
}
-
- Veteran
- Posts: 7328
- Liked: 781 times
- Joined: May 21, 2014 11:03 am
- Full Name: Nikita Shestakov
- Location: Prague
- Contact:
Re: Script to list all VMs and which jobs they are in
Neil,
As I stated above Protected VMs as it shows explicitly which VMs are not protected and which VMs belong to the shown jobs. Please check if it`s suitable for you.
Protected VMs job schedule report is more about planning.
Thanks!
As I stated above Protected VMs as it shows explicitly which VMs are not protected and which VMs belong to the shown jobs. Please check if it`s suitable for you.
Protected VMs job schedule report is more about planning.
Thanks!
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Script to list all VMs and which jobs they are in
You mean native PowerCLI commandlet work faster than Find-VBRViEntity does?The script is getting there although as it calls PowerCLI get-view for the contents of folders (for speed)
Excluded objects have IsExcluded parameter equal to $True:it cannot not tell you which VMs are excluded
Code: Select all
$Job.GetObjectsInJob() | where {$_.isexcluded -eq $true}
-
- Enthusiast
- Posts: 32
- Liked: 4 times
- Joined: Apr 13, 2012 3:51 pm
- Full Name: Neil Colthorpe
- Contact:
Re: Script to list all VMs and which jobs they are in
OK, I ran report: VM > Protected VMs. Says there are total VMs 93 (there are a lot more than that). Says protected VMs are 76. The daily script I use from Shawn Masterson says have over 400 protected VMs.Neil,
As I stated above Protected VMs as it shows explicitly which VMs are not protected and which VMs belong to the shown jobs. Please check if it`s suitable for you.
Protected VMs job schedule report is more about planning.
Thanks!
-
- Veteran
- Posts: 7328
- Liked: 781 times
- Joined: May 21, 2014 11:03 am
- Full Name: Nikita Shestakov
- Location: Prague
- Contact:
Re: Script to list all VMs and which jobs they are in
Have you chosen all Virtual Infrastructure or just some VM folders in the scope?
Thanks!
Thanks!
-
- Enthusiast
- Posts: 32
- Liked: 4 times
- Joined: Apr 13, 2012 3:51 pm
- Full Name: Neil Colthorpe
- Contact:
Re: Script to list all VMs and which jobs they are in
Yay, that got it. I set RPO to 1 day and looks like it's got them all. Shows available restore points as a bonus
Thanks
Neil
Thanks
Neil
-
- Veteran
- Posts: 7328
- Liked: 781 times
- Joined: May 21, 2014 11:03 am
- Full Name: Nikita Shestakov
- Location: Prague
- Contact:
Re: Script to list all VMs and which jobs they are in
Great!
If you think some other information would be useful and appropriate for the report, let me know. Thanks!
If you think some other information would be useful and appropriate for the report, let me know. Thanks!
-
- Lurker
- Posts: 1
- Liked: never
- Joined: Jul 17, 2015 8:53 am
- Contact:
Re: Script to list all VMs and which jobs they are in
I want to write a script that compares all the backup's in Veeam to the list from VMware.
Now tested all the script mentioned on this topis but did not do the job.
They all include the server who are excluded. We speak about +200 servers
Now I need a script that list up all servers from all backup jobs, weh have a 30 different jobs (1) and from all of those jobs I need to get all servers (2) in a list.
regards
Now tested all the script mentioned on this topis but did not do the job.
They all include the server who are excluded. We speak about +200 servers
Now I need a script that list up all servers from all backup jobs, weh have a 30 different jobs (1) and from all of those jobs I need to get all servers (2) in a list.
regards
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Script to list all VMs and which jobs they are in
Have you taken a look at the one-liner that is supposed to list excluded servers? Using that list you can compare it then to list of existing backup job objects and exclude those that are present into both lists. Thanks.
-
- Enthusiast
- Posts: 32
- Liked: 4 times
- Joined: Apr 13, 2012 3:51 pm
- Full Name: Neil Colthorpe
- Contact:
Re: Script to list all VMs and which jobs they are in
Hi, just thought of what would be useful: a column with the backup repository so I can make sure each VM is backed up to the correct site.Great!
If you think some other information would be useful and appropriate for the report, let me know. Thanks!
-
- Veteran
- Posts: 7328
- Liked: 781 times
- Joined: May 21, 2014 11:03 am
- Full Name: Nikita Shestakov
- Location: Prague
- Contact:
Re: Script to list all VMs and which jobs they are in
It makes sense, we will add it in the next versions. Thanks for the request!ncolt wrote:Hi, just thought of what would be useful: a column with the backup repository so I can make sure each VM is backed up to the correct site.
-
- Veteran
- Posts: 459
- Liked: 5 times
- Joined: Feb 01, 2012 12:04 pm
- Full Name: Mario
- Contact:
[MERGED] Listing VMs excluded from jobs
I discovered that (for reasons still to be investigated) some VMs were excluded by jobs and are not processed.
Some VM were deliberately exluded, others were excluded automatically, maybe after errors.
How can I get a list of all the VM excluded by jobs without opening each single job?
Regards
marius
Some VM were deliberately exluded, others were excluded automatically, maybe after errors.
How can I get a list of all the VM excluded by jobs without opening each single job?
Regards
marius
-
- Lurker
- Posts: 1
- Liked: never
- Joined: Aug 01, 2017 10:44 am
- Full Name: Jari Arkoma
- Contact:
[MERGED] Exclusions in Get-VBRBackup (v9.5)?
Hello,
is it somehow possible to get count of excluded VM's in a job?
Like Get-VBRBackup gives VmCount in job details, could there be count of excluded VM's, too? It would be handy (easy to script, at least) if it just shows ExcludedVmCount or something.
Enterprise manager reports page seems to leave excluded VM's out of VM Count. Something I try to do with Get-VBRBackup, too.
Br,
Jari
is it somehow possible to get count of excluded VM's in a job?
Like Get-VBRBackup gives VmCount in job details, could there be count of excluded VM's, too? It would be handy (easy to script, at least) if it just shows ExcludedVmCount or something.
Enterprise manager reports page seems to leave excluded VM's out of VM Count. Something I try to do with Get-VBRBackup, too.
Br,
Jari
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Script to list all VMs and which jobs they are in
Use the example above to list VMs excluded from processing. Once those VMs are listed, you can easily count them. Thanks.
Who is online
Users browsing this forum: No registered users and 5 guests