I still don't understand how you intend to differentiate vm name and computer name. In our Powershell module vm name you see in a restore point or a storage equals to computer name (if talking about a vm as of a computer). If you mean the other case, like, machines backed up with agent backup job, please let me know.
Now, about other properties. You can get VM Name slightly adjusting your script to get restore points first:
Code: Select all
$backups = Get-VBRBackup
foreach ($backup in $backups) {
$rps = Get-VBRRestorePoint -Backup $backup
foreach ($rp in $rps) {
$storage = $rp.GetStorage()
$storage | select @{n='Name';e={$_.PartialPath}}, @{n='VmName';e={$rp.VmName}}, @{n='DataSize';e={$_.Stats.DataSize}}, `
@{n='BackupSize';e={$_.Stats.BackupSize}} | Export-Csv -Path 'C:\report.csv' -append
}
}
As for ProvisionedSize, if you mean the size of an original vm, you would need to match object in a restore point with an infrastructure object and then get ProvisionedSize from that infrastructure object:
Code: Select all
$backups = Get-VBRBackup
foreach ($backup in $backups) {
$rps = Get-VBRRestorePoint -Backup $backup
foreach ($rp in $rps) {
$storage = $rp.GetStorage()
$object = $rp.GetObject()
$vm = Find-VBRViEntity -VMsAndTemplates | where {$_.Reference -eq $object.ObjectRef}
$storage | select @{n='Name';e={$_.PartialPath}}, @{n='VmName';e={$rp.VmName}}, @{n='DataSize';e={$_.Stats.DataSize}}, `
@{n='BackupSize';e={$_.Stats.BackupSize}}, @{n='ProvisionedSize';e={$vm.ProvisionedSize}} | Export-Csv -Path 'C:\report.csv' -append
}
}
The trick with ProvisionedSize works with VMware vms only though.
Best regards,
Oleg