I share my powershell script with you and I want correction about somes cases.
First find here my function:
Code: Select all
#-------------------------------
#Get Backup info for all servers (last full and incrementals) in all jobs:
#-------------------------------
$Global:LastPointServers=@()
$Global:LastPoints=@()
$Global:Backups=@()
$Global:BackupsStorage=@()
function GetInfo-VBRRestorePoints {
$Chains=@($Global:LastPoints[$Global:LastPoints.Count-1].GetChain())
foreach($Chain in $Chains)
{
$HostName=$Chain.HvAuxData.HostName
if (! $HostName) {
$HostName=$Chain.Info.AuxData | select-xml -XPath //EsxName | foreach {$_.node.InnerXML}
}
#$BackupSize=$Global:BackupsStorage | ?{$_.BackupId -eq $Chain.BackupId}
$BackupSize=$Global:BackupsStorage | ?{$_.ObjectId -eq $Chain.ObjectId}
$BackupSize=$BackupSize | ?{$_.Id -eq $Chain.StorageID}
$BackupSize=$BackupSize.Stats.BackupSize
$LastPointServer=[Ordered]@{"Name"=$Chain.Name;"Type"=$Chain.Type;"CreationTime"=$Chain.CreationTime;"BackupSize"=$BackupSize;"HostName"=$HostName}
$Global:LastPointServers += New-Object -TypeName PSObject -Property $LastPointServer
$LastPointServer | ft -AutoSize
}
}
function GetInfoServers {
#$RepoExport=Get-VBRBackupRepository -Name "Backup Repository Export"
$VBRRestore=Get-VBRRestorePoint
$DesktopPath = [Environment]::GetFolderPath("Desktop")
$Global:LastPointServers=@()
$Global:LastPoints=@()
$InfoServers=Get-VBRJob | where Name -notlike "Backup Copy*" | Get-VBRJobObject | select-object Name | sort Name
$Global:Backups=Get-VBRBackup | where {$_.JobID -notlike "*0000-0000*" -and $_.Name -notlike "Backup Copy*"}
$Global:BackupsStorage=$Global:Backups.GetAllStorages()
foreach($InfoServer in $InfoServers){
$Global:LastPoints=$VBRRestore | where {$_.Name -like $InfoServer.Name} | sort vmname, creationtime
GetInfo-VBRRestorePoints
}
$Global:LastPointServers | sort Name, CreationTime | Export-Csv -force -Path "$DesktopPath\VM list Restore Points Full & Incrementals.txt" -Delimiter ';' -NoTypeInformation
}
GetInfoServers
1) Get All Restore Points
2) et All Backup Jobs (exclude "Backup Copy" and JobId starting with "00000*" because seems job not exists anymore (? )
3) Get All Storages Infos
4) For each VM saved in all jobs => Get last Full + all incrementals (after last full)
5) function GetInfo-VBRRestorePoints is to TRY get infos for #4 and create an array 'LastPointServers'
All working except in somes cases:
I cannot find ALWAYS storage info with:
$BackupSize=$Global:BackupsStorage | ?{$_.BackupId -eq $Chain.BackupId}
$BackupSize=$Global:BackupsStorage | ?{$_.ObjectId -eq $Chain.ObjectId}
$BackupSize contents correct info or return empty. I do not understand why.
It is produce with VMware And HyperV jobs.
Find here output sample : 5st are Ok : Full and all inc)
"Name";"Type";"CreationTime";"BackupSize";"HostName"
"Cisco Unified Communications Manager";"Full";"03-04-23 21:03:55";"17604599296";"ESXCUCM"
"Cisco Unified Communications Manager";"Increment";"06-04-23 11:54:54";"640985600";"ESXCUCM"
"Cisco Unified Communications Manager";"Increment";"06-04-23 19:01:22";"149664256";"ESXCUCM"
"Cisco Unified Communications Manager";"Increment";"07-04-23 19:01:06";"308016640";"ESXCUCM"
"Cisco Unified Communications Manager";"Increment";"08-04-23 19:01:01";"357428224";"ESXCUCM"
"SRV-HE-DNS-DMZ-01";"Full";"01-04-23 18:22:32";"2103304192";"srv-sc-esx-ha-1"
"SRV-HE-IDTECH2";"Full";"08-04-23 23:03:37";;"srv-sc-hv-ha-2"
"SRV-HE-RELAY22";"Full";"02-04-23 10:32:10";"41039614976";"SRV-SC-HV-HA-3"
"SRV-HE-SALTO";"Full";"08-04-23 23:38:52";;"SRV-SC-HV-HA-3"
"SRV-HE-WEB-ALUMNI-1";"Full";"08-04-23 23:31:38";;"srv-sc-esx-ha-1"
"SRV-HE-WEB-APP-1";"Full";"07-04-23 23:32:24";"135442296320";"srv-sc-esx-ha-1"
"SRV-SC-EASI-APP";"Full";"08-04-23 23:51:19";;"srv-sc-esx-ha-2"
"SRV-SC-EASI-TST";"Full";"08-04-23 23:30:20";;"SRV-SC-HV-HA-3"
"SRV-SC-EASI-WEB";"Full";"08-04-23 23:48:16";;"srv-sc-esx-ha-2"
Thanks
Rem: My Version is 9.5 and waiting for reinstall my veeam server on Server 2022 with VB v11 or v12
Hope my script continue to work after upgrade to VB 11/12
