Ich verwende das folgende Skript von der Microsoft-Website, um eine Imagesicherung meiner Server zu erstellen. Das Problem ist, dass ich eine externe Festplatte auf einem meiner Server habe und das Sicherungsskript immer die externe Festplatte in die Imagesicherung einbezieht.
Was muss ich im Skript ändern, damit alle Server ohne externe Festplatte ausgeführt werden?
Quelle: https://gallery.technet.microsoft.com/scriptcenter/WSB-Backup-network-email-9793e315#content
Ausgabe von Get-WBVolume-AllVolumes
VolumeLabel: System reserviert
MountPath:
MountPoint: \\? \ Volume {e1c711f2-9b80-11e4-80b4-806e6f6e6963}
Dateisystem: NTFS
Eigenschaft: Critical, ValidSource, IsOnDiskWithCriticalVolume
FreeSpace: 75513856
TotalSpace: 367001600
VolumeLabel: HD2_BACKUP
MountPath: E:
MountPoint: \\? \ Volume {ec27b343-e89b-11e4-80de-000c290bce57}
Dateisystem: NTFS
Eigenschaft: ValidSource
FreeSpace: 754411352064
TotalSpace: 1000202043392
VolumeLabel: SYSTEM
MountPath: C:
MountPoint: \\? \ Volume {e1c711f3-9b80-11e4-80b4-806e6f6e6963}
Dateisystem: NTFS
Eigenschaft: Critical, ValidSource, IsOnDiskWithCriticalVolume
FreeSpace: 77012553728
TotalSpace: 107005083648
# erfordert -version 2.0
#Initialize WSB Cmdlets
if ((Get-PSSnapin -Name Windows.ServerBackup -ErrorAction SilentlyContinue) -eq $ null)
{
Add-PsSnapin Windows.ServerBackup
}
# ------------------------------------------------- -----------------
#Variablen
# ------------------------------------------------- -----------------
#Dateiserver
$ Nas = "\\ FSVM001"
#Root-Verzeichnis
$ HomeBkpDir = ($ Nas + "\ backup")
#Backup-Ordner
$ Filename = Get-Date -Format MMddyyyy_hhmmss
#Nummer der zu speichernden Sicherung (Wert "0" deaktiviert die Rotation)
$ MaxBackup = 1
#Listen Sie unkritische Volumes auf
$ Volumes = Get-WBVolume -AllVolumes | Where-Object {$ _. Property -notlike "Critical *"}
# ------------------------------------------------- -----------------
#Funktion zum Vergleichen der Anzahl der zu speichernden Ordner
# $ MaxBackup (Nein, wenn $ MaxBackup gleich 0 ist)
# ------------------------------------------------- -----------------
Funktion Rotation ()
{
#Listen Sie alle Sicherungsordner auf
$ Backups = @ (Get-ChildItem -Path $ HomeBkpDir \ *)
#Anzahl der Sicherungsordner
$ NbrBackups = $ Backups.count
$ i = 0
#Löschen Sie die ältesten Sicherungsordner
while ($ NbrBackups -ge $ MaxBackup)
{
$ Backups [$ i] | Remove-Item -Force -Recurse -Confirm: $ false
$ NbrBackups - = 1
$ i ++
}
}
# ------------------------------------------------- -----------------
#Funktion zum Senden einer E-Mail-Benachrichtigung
# ------------------------------------------------- -----------------
Funktion EmailNotification ()
{
#Absender E-Mail
$ Sender = "sender.at.corpnet.net"
#E-Mail empfangen
$ Receipt = "receipt.at.contoso.com"
#SMTP-Server
$ Server = "smtp.corpnet.net"
#Mail-Betreff
$ Object = $ env: Computername + ": Sicherungsbericht von" + (Get-Date)
#Mail-Inhalt
$ Content = Get-WBJob -Previous 1 | ConvertTo-Html -As Liste | Out-String
$ SMTPclient = neues Objekt System.Net.Mail.SmtpClient $ Server
# Geben Sie bei Bedarf den SMTP-Port an
# $ SMTPClient.port = 587
#Aktivieren Sie bei Bedarf SSL
# $ SMTPclient.EnableSsl = $ true
#Geben Sie bei Bedarf die Anmeldeinformationen des E-Mail-Kontos an
# $ SMTPAuthUsername = "login"
# $ SMTPAuthPassword = "Passwort"
# $ SMTPClient.Credentials = New-Object System.Net.NetworkCredential ($ SMTPAuthUsername, $ SMTPAuthPassword)
$ Nachricht = neues Objekt System.Net.Mail.MailMessage $ Absender, $ Empfang, $ Objekt, $ Inhalt
$ Message.IsBodyHtml = $ true;
$ SMTPclient.Send ($ Message)
}
# ------------------------------------------------- -----------------
#Main
# ------------------------------------------------- -----------------
#Rotation ausführen, falls aktiviert
if ($ MaxBackup -ne 0)
{
Drehung
}
#Backup-Ordner erstellen
New-Item ($ HomeBkpDir + "\" + $ Filename) -Type Directory | Out-Null
$ WBPolicy = New-WBPolicy
#Enable BareMetal-Funktionalität (einschließlich Systemstatus)
Add-WBBareMetalRecovery -Policy $ WBPolicy | Out-Null
# Sicherungsziel hinzufügen
$ BackupLocation = New-WBBackupTarget -network ($ HomeBkpDir + "\" + $ Filename)
Add-WBBackupTarget -Policy $ WBPolicy -Target $ BackupLocation -force | Out-Null
#Fügen Sie unkritische Volumes hinzu
if ($ Volumes -ne $ null)
{
Add-WBVolume -Policy $ WBPolicy -Volume $ Volumes | Out-null
}
$ WBPolicy | Out-Null
Start-WBBackup -Policy $ WBPolicy
#E-Mail-Benachrichtigungsfunktion aufrufen
Email Benachrichtigung
Get-WBVolume -AllVolumesund uns mitteilen, welches dieser Volumen ausgeschlossen werden soll?