I want to test backups after completion by confirming that I can recover a sentinel file.
We all know that a frequent backup, and later storage, copy in a different environment provides extra security. For that purpose, our backup storage server, named Vault, keeps multiple extra copies of our daily backups.
Testing sample code:
$Backup = '\\localhost\d$\Vault\One'
$ex =""
try{
# I have no clue how to get the servers from Get-WBBackupSet, so, resort to parsing the error
# Get-WBBackupSet error response when multiple backups are stored:
#Backups of multiple computers are in the backup storage location. The computers for which backups are present are:
#bdc iis myblue quickbooks sqlserver <redacted> .
#Please specify the computer that you want to manage backups for.
$servers=@{}
Get-WBBackupSet -BackupTarget $BackupTarget
} catch {
$m=($_ -split "`r`n")[0]
$ix=$m.IndexOf(":")
$l=$m.Substring($ix+1)
$ix=$l.IndexOf(" . ")
$Servers=$($l.Substring(0,$ix).split(" "))|? {$_ -ne ''} }
$servers | %{
$BackupSet = Get-WBBackupSet -BackupTarget $BackupTarget -MachineName $_
Write-host " $("$_".PadRight(12))$($($BackupSet.BackupTime).ToString("yyyy-MM-dd hh:mm tt ddd"))"
$BackupSet.Volume | ? { $_.MountPath -ne '' } | % {
$V=$_
Write-Host $($v.VolumeLabel.PadRight(12)) $($v.MountPath.PadRight(6)) " `
"$(($_.FreeSpace/1GB).tostring("n2").PadLeft(8))Gb $(($_.TotalSpace/1GB).ToString("n2").PadLeft(8))Gb "
Get-WBBackupVolumeBrowsePath -VolumeInBackup $_ -BackupSet $BackupSet
}
}
I can't get Get-WBBackupVolumeBrowsePath to work to recover a well-known sentinel file stored on each volume:
"\\localhost\d$\Vault\One"
admin 2020-03-13 07:00 PM Fri
C: 21.38GB 59.46GB
Get-WBBackupVolumeBrowsePath : an attempt to retrieve the properties for the backup set
failed because the backup set is not in the catalog.
at "C:\Repos\PowerShell\BackupStatus.ps1":... char:13
+ Get-WBBackupVolumeBrowsePath -VolumeInBackup $_ -Backup ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WBBackupVolumeBrowsePath], Exception
+ FullyQualifiedErrorId : System.Exception,Microsoft.Windows.ServerBackup.Commands.GetWBBackupVolumeBrowsePath
Where or how to reference a catalog? Using WBbackup, I can open and retrieve a single file from Vault, but I have about 25 servers' backups to check!!!