by Stan Czerno
March 1, 2014 13:13 CST
So I was browsing for a good PowerShell script that uses the built-in Windows Server Backup features. Augagneur Alexandre's script http://gallery.technet.microsoft.com/scriptcenter/WSB-Backup-network-email-9793e315 was a good start, so I took it a little further.
Uses Windows Server Backup Features.
Creates a Bare Metal Recovery and Full VSS Backup.
Saves Backup to \\ServerName\ShareName\ComputerName\Current.
Allows for retaining older backups, you can set how many.
If the $MaxBackup variable is set to anything greater than 0 and the previous backup was successful, the script copies the current backup folder to \\ServerName\ShareName\ComputerName\Archive\<CurrentDate> before starting a new backup.
Sends an email with a summary and full log as an attachment.
http://www.czerno.com/default.asp?inc=/html/windows/WindowsBackup/WindowsBackupScript.asp
Here is a version that will work with Windows Server 2012:
http://www.czerno.com/default.asp?inc=/html/windows/WindowsBackup/2012/WindowsBackupScript2012.asp