I like to get a List of BackupJobs with: Get-VBRJob -Name * to show the VM-Names ( in my Case: VM1 & VM2 )
to use it with: Get-VBRJobObject
So my wish is to have this output:
VM1
VM2
Get-VBRJob -Name *
Job Name Type State Last Result Description
-------- ---- ----- ----------- -----------
VM1_JOB VMware Backup Stopped Success Created by WIN-QLOUAP15J4L\Administrator at 28.02.2022 13:27.
VM2_JOB VMware Backup Stopped Success Created by WIN-QLOUAP15J4L\Administrator at 28.02.2022 14:11.
Get-VBRJobObject -Job VM2_JOB
Name Type ApproxSize Location
---- ---- ---------- --------
VM2 Include 16 GB 192.168.11.220\server...
Code: Select all
$jobarray = Get-VBRJob -Name *
foreach ($job in $jobarray)
{
$JobName = $job
$JobObject = Get-VBRJob -name $JobName
$Objects = $JobObject.GetObjectsInJob()
$Objects.name
}
Error Messages:
Code: Select all
Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.
In Zeile:6 Zeichen:1
+ $Objects = $JobObject.GetObjectsInJob()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
VM2
Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.
In Zeile:6 Zeichen:1
+ $Objects = $JobObject.GetObjectsInJob()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
VM2