我想在完成后测试备份,确认我可以恢复哨兵文件。
我们都知道,频繁备份并在之后将副本存储在不同的环境中可以提供额外的安全性。为此,我们的备份存储服务器(名为Vault
)会保留我们每日备份的多个额外副本。
测试示例代码:
$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
}
}
我无法开始Get-WBBackupVolumeBrowsePath
恢复存储在每个卷上的知名哨兵文件:
"\\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
在哪里或如何引用目录?使用WBbackup
,我可以打开并从中检索单个文件Vault
,但我有大约 25 个服务器的备份需要检查!!!
答案1
Get-BackupSet
本身将返回系统目录中的所有备份集。您应该可以使用其中任何一个,但Get-WBBackupVolumeBrowsePath
似乎要求将备份集放在您的系统目录中(而不是其他路径),以便能够在后台以交互方式挂载它。
您可以直接恢复文件,无需考虑WBBackupVolumeBrowsePath
,并检查恢复中是否存在错误:
Start-WBFileRecovery -BackupSet $BackupSet -FilePathToRecover "C:\Dir1" -Recursive -FileRecoveryOption CreateCopyIfExists -Force