Estou usando o seguinte script do site da Microsoft para criar um backup de imagem dos meus servidores. O problema é que eu tenho um disco rígido externo em um dos meus servidores e o script de backup sempre inclui o disco rígido externo para o backup da imagem.
O que devo modificar no script para criar todo o servidor sem o disco externo?
Fonte: link
OUTPUT DE Get-WBVolume -AllVolumes
VolumeLabel : System Reserved MountPath : MountPoint : \?\Volume{e1c711f2-9b80-11e4-80b4-806e6f6e6963} FileSystem : NTFS Property : Critical, ValidSource, IsOnDiskWithCriticalVolume FreeSpace : 75513856 TotalSpace : 367001600 VolumeLabel : HD2_BACKUP MountPath : E: MountPoint : \?\Volume{ec27b343-e89b-11e4-80de-000c290bce57} FileSystem : NTFS Property : ValidSource FreeSpace : 754411352064 TotalSpace : 1000202043392 VolumeLabel : SYSTEM MountPath : C: MountPoint : \?\Volume{e1c711f3-9b80-11e4-80b4-806e6f6e6963} FileSystem : NTFS Property : Critical, ValidSource, IsOnDiskWithCriticalVolume FreeSpace : 77012553728 TotalSpace : 107005083648
#requires -version 2.0 #Initialize WSB cmdlets if ( (Get-PSSnapin -Name Windows.ServerBackup -ErrorAction SilentlyContinue) -eq $null ) { Add-PsSnapin Windows.ServerBackup } #------------------------------------------------------------------ #Variables #------------------------------------------------------------------ #Files server $Nas = "\FSVM001" #Root folder $HomeBkpDir = ($Nas+"\backup") #Backup folder $Filename = Get-Date -Format MMddyyyy_hhmmss #Number of backup to retain (value "0" disable rotation) $MaxBackup = 1 #List uncritical volumes $Volumes = Get-WBVolume -AllVolumes | Where-Object { $_.Property -notlike "Critical*" } #------------------------------------------------------------------ #Function to compare the number of folders to retain with #$MaxBackup (No called if $MaxBackup equals 0) #------------------------------------------------------------------ function Rotation() { #List all backup folders $Backups = @(Get-ChildItem -Path $HomeBkpDir\*) #Number of backups folders $NbrBackups = $Backups.count $i = 0 #Delete oldest backup folders while ($NbrBackups -ge $MaxBackup) { $Backups[$i] | Remove-Item -Force -Recurse -Confirm:$false $NbrBackups -= 1 $i++ } } #------------------------------------------------------------------ #Function to send email notification #------------------------------------------------------------------ function EmailNotification() { #Sender email $Sender = "sender.at.corpnet.net" #Receipt email $Receipt = "receipt.at.contoso.com" #SMTP Server $Server = "smtp.corpnet.net" #Mail subject $Object = $env:computername+": Backup report of "+(Get-Date) #Mail content $Content = Get-WBJob -Previous 1 | ConvertTo-Html -As List | Out-String $SMTPclient = new-object System.Net.Mail.SmtpClient $Server #Specify SMTP port if needed #$SMTPClient.port = 587 #Activate SSL if needed #$SMTPclient.EnableSsl = $true #Specify email account credentials if needed #$SMTPAuthUsername = "login" #$SMTPAuthPassword = "password" #$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($SMTPAuthUsername, $SMTPAuthPassword) $Message = new-object System.Net.Mail.MailMessage $Sender, $Receipt, $Object, $Content $Message.IsBodyHtml = $true; $SMTPclient.Send($Message) } #------------------------------------------------------------------ #Main #------------------------------------------------------------------ #Execute rotation if enabled if ($MaxBackup -ne 0) { Rotation } #Backup folder creation New-Item ($HomeBkpDir+"\"+$Filename) -Type Directory | Out-Null $WBPolicy = New-WBPolicy #Enable BareMetal functionnality (system state included) Add-WBBareMetalRecovery -Policy $WBPolicy | Out-Null #Add backup target $BackupLocation = New-WBBackupTarget -network ($HomeBkpDir+"\"+$Filename) Add-WBBackupTarget -Policy $WBPolicy -Target $BackupLocation -force | Out-Null #Add uncritical volumes if ($Volumes -ne $null) { Add-WBVolume -Policy $WBPolicy -Volume $Volumes | Out-null } $WBPolicy | Out-Null Start-WBBackup -Policy $WBPolicy #Call email notification function EmailNotification