We have a custom PowerShell script that we use to generate a report each month to bill customers for consumed storage. It outputs a table that contains the name of the job, all VMs within that job, the actual size of the VM, and an approximation of the backup size for each VM. I have pasted the code below. We've been using this script since version 6.5 with no issues. Since upgrading to version 9, we are unable to get the "VMSize" and "BackupSize" to populate. I've done a bit of digging, and part of the issue appears to be that the "AuxData" property is no longer a part of the "GetObjectOibsAll" method. Does anyone have any ideas to help us get this script working in 9.0? Is there a new cmdlet or property that will give the same information that the "AuxData" property used to provide?
Thanks in advance!
Code: Select all
$CSVFile = "C:\scripts\VanCTRVeeam\VeeamBackup.csv"
Add-PSSnapIn VeeamPSSnapIn -ErrorAction SilentlyContinue
$cdate=Get-Date
$backups=@()
foreach ($bkp in Get-VBRBackup) {
$DataSize = ($bkp.GetObjectOibsAll()|select -ExpandProperty AuxData|select -ExpandProperty RealVmSize|measure -sum).sum
$BkpSize = ($bkp.GetStorages()|select -ExpandProperty Stats|select -ExpandProperty BackupSize|measure -sum).sum
foreach ($obj in $bkp.GetObjectOibsAll()) {
$vm = New-Object PSObject -Property @{
BackupDate = $cdate
JobName = $bkp.JobName
VMName = $obj.Name
VMSize = $obj.AuxData.RealVmSize
BackupPct = $obj.AuxData.RealVmSize / $DataSize
BackupSize = $BkpSize * ($obj.AuxData.RealVmSize / $DataSize)
}
$backups += $vm
}
$DataSize = 0
$BkpSize = 0
}
$backups|select BackupDate, JobName, VMName, VMSize, BackupSize |Export-Csv -NoTypeInformation $CSVFile