Enter SharePoint Backup Augmentation Cmdlets from CodePlex (http://sharepointbac.codeplex.com).
SharePointBAC makes it possible to groom backup sets, archive backups, and more. While the version on codeplex supports 2010, I was able to obtain the 2013 source files from Trevor Seward, MVP.
Once the solution is added and deployed, the following 5 new command-lets become available:
- Get-SPBackupCatalog: Retrieves an SPBackupCatalog object for a selected backup location and exposes properties of the catalog
- Export-SPBackupCatalog: Generates an export/archive of one or backup sets that is compressed as a zip file by default
- Remove-SPBackupCatalog: Performs grooming (i.e., cleaning out old backups) on a backup catalog and its associated backup sets
- Send-SPBackupStatus: E-mails a summary of the last backup operation to selected recipients using the farm's outbound e-mail configuration
- Set-SPBackupCatalog: Updates properties on an SPBackupCatalog object (more specifically, its underlying spbrtoc.xml catalog file)
Here is a sample .ps1 script utilizing SharePointBAC solution which will backup farm and retain only the most recent backup:
$cat = Get-SPBackupCatalog \\server\Share
Backup-SPFarm -Directory \\server\Share -BackupMethod Full
$cat | Remove-SPBackupCatalog -RetainCount 1 -Confirm:$false
$cat | Send-SPBackupStatus -Recipients "firstname.lastname@example.org"