i need a powershell-script who returns me, who many VMs/Backups in a Job are completed/running.
I have found in the Forum the following snipped, who list me the VMs in a Job - that works fine:
Code: Select all
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
$jobname = "xyz"
# Get entire vCenter VM hierarchy using VM and Template view for object [ath
$vmsandtemplates = Find-VBRViEntity -VMsAndTemplates
$vmfoldertree = $vmsandtemplates |? {$_.Type -eq "Vm"}
$vmfolders = $vmsandtemplates |? {$_.Type -eq "Folder"}
# Get Backup Job
$job = Get-VBRJob -Name $jobname | Sort -Property Name
write-Host $job.Name
# Get all included objects in job (assumes single folders)
$jobobjs = $job.GetObjectsInJob() | ?{$_.Type -eq "Include"}
# Get path for folder object
$jobobjid = $jobobjs.GetObject().Info.HostId.ToString() + "_" + $jobobjs.GetObject().Info.ObjectId
$jobobjpath = ($vmfolders | ?{$_.Id -eq "$jobobjid"}).Path
write-host $jobobjpath
# Get subset of VMs that are in the folder
$vmsinfolder= $vmfoldertree |?{$_.Path -like "$jobobjpath*"} | Sort -Property Name
ForEach ($vm in $vmsinfolder) {
write-host " " $vm.Name
}
For the Job i have found a lot of solutions, but i need the info for VMs in a job.
Target-Output is, e.g. "13 of 35 VMs completed in Job xyz".
Kind regards,
tcz