Powershell을 사용하여 Windows 서버 백업

Powershell을 사용하여 Windows 서버 백업

센티넬 파일을 복구할 수 있는지 확인하여 백업 완료 후 테스트하고 싶습니다.

우리 모두는 다른 환경에서 자주 백업하고 나중에 저장하고 복사하면 추가 보안이 제공된다는 것을 알고 있습니다. 이를 위해 이름이 지정된 백업 스토리지 서버는 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각 볼륨에 저장된 잘 알려진 Sentinel 파일을 복구하는 작업을 시작할 수 없습니다 .

"\\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

관련 정보