PowerShell script exchange
Post Reply
avandeven
Novice
Posts: 3
Liked: never
Joined: Sep 01, 2016 7:13 pm
Full Name: Adam Vande Ven
Contact:

.getObjectsInJob or .GetVIOijs do not return all VMs

Post by avandeven »

Hey Veeam and Powershell Gurus!

I have a backup job that has a VMware cluster selected. When trying to access all of the VMs from that cluster with Powershell, I'm missing one or two of the VMs:

Code: Select all

$jobs = Get-VBRJob -WarningAction silentlyContinue | ? { $_.jobtype -eq 'Backup' }
$objects = $jobs.GetViOijs()
$objects.name
The results show me the majority of the VMs in the job (there are some duplicates as well), but then is clearly missing some when comparing it directly to the VM list when the job ran last night. I have also tried using .getObjectsInJob as well with similar results.

Is there something that I'm missing here?

Thank you,
Adam
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: .getObjectsInJob or .GetVIOijs do not return all VMs

Post by veremin »

Haven't heard about that. The given method (similar to Get-VBRJobObject cmdlet) should return all backup job source objects. Thanks.
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: .getObjectsInJob or .GetVIOijs do not return all VMs

Post by tdewin »

Did you add for example containers to the job (eg datastore, resource pool, cluster, tags, etc..)? The containers will only resolve the VM's at the moment of backup so that if a new VM is created inside this container, it will be "automatically" add to the job.

The "downside" is that you can not lookup the VM's add the job via powershell this way because it will only return the containers.
avandeven
Novice
Posts: 3
Liked: never
Joined: Sep 01, 2016 7:13 pm
Full Name: Adam Vande Ven
Contact:

Re: .getObjectsInJob or .GetVIOijs do not return all VMs

Post by avandeven »

Thanks tdewin,

I do have a container added to the job (I've added the VMware cluster), I still assumed that Veeam would be able to tell me which child VMs were part of that container as a result of the previous backup job. I'm seeing about almost of the VMs that were backed up the previous night, with just one or two that are mysteriously missing.

Is this worth a support case, or is this expected behavior?

Thank you!
Adam
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: .getObjectsInJob or .GetVIOijs do not return all VMs

Post by tdewin »

Just quickly tested. It is important to start from the result (eg the backup) instead of the job itself, since you are using containers

This is a more supported approach but it will get all the vms in all the restore points. So you need to filter out the duplicates. However it should show all VM's even if they were not in the latest point

Code: Select all

$backup = Get-VBRBackup -Name  "Backup Job 1"
$restorepoints = $backup | Get-VBRRestorePoint
$restorepoints | select VmName | Sort-Object | Get-Unique
This might be more performant, but as stated not supported as you are calling direct .net code. It will only show VM's in the last restore points. Maybe you have some VM's that have been deleted but still have restore points?

Code: Select all

$backup = Get-VBRBackup -Name  "Backup Job 1"
$backup.GetLastPoint().GetOibs() | select VmName
Post Reply

Who is online

Users browsing this forum: bbuckles and 17 guests