I'm using this script to have a list of VMs into all Jobs, with following code:
Code: Select all
$JobNumber=0
$VMNumber=0
$JobList = Get-VBRJob | ?{$_.JobType -eq "Backup"}
foreach($Jobobject in $JobList) {
$JobName = $Jobobject.Name
Write-Host "JOB: $JobName"
$JobNumber++
$VMList = $JobObject.GetObjectsInJob()
foreach($VMObject in $VMList) {
$VMName = $VMObject.name
Write-Host " ---> VMName: $VMName"
$VMNumber++
}
}
If the job contains a Folder or Resource Pool the $VMName contains not the VMs, but only the RP name.
And the vApps are never counted.
How to count VMs and/or vApps editing what above?
Thanks!
Simon