the cmdlet Find-VBRHvEntity returns VMs from all hosts connected to Veeam not only from backup jobs and when I use cmdlet Add-VSBHvApplicationGroup and add this VM to application group and create Sure Backup Job using cmdlet Add-VSBHvJob I'm getting an error that VM id 'xxx' cannot be found.
Hello
as you can setup a backup job to backup VM from anything (pool, datastore, folder, etc...) you won't find VM information in the JOB object, they are discovered at run time.
you will need to get the session for a specific job, here is how to get the last finished backup session for a given $Job :
$session=get-vbrbackupsession | ? jobid -eq $job.id.Guid | Sort EndTimeUTC -Descending | Select -First 1
next you need to get the TASKS :
$tasks = $sessions|Get-VBRTaskSession
each task name is the name of a VM (probably, I didn't have any other output on my various setups)
$tasks.name
will give you the list of the all VM Name that were in that specific job (and you can even get the backup status)
if you want more VM information, you need powercli from vmware to get ID or guest host name.
- Get backup job (Get-VBRJob)
- Get backup job object (Get-VBRJobObject)
- Find unique VM identifier (be it Id or name)
- Use it as filter parameter to locate VM objects (Find-VBRHvEntity)