Remove Old SharePoint Backup Files

8. August 2013 14:09 by Matt in Information Technology Adventures  //  Tags: , ,   //   Comments (0)

submit to reddit

Backups should be part of any production environment. Over time, backup files can accumulate and take up space in your storage location. With SharePoint, removing unneeded backup files isn't as simple as deleting the files or folders. Within the storage location, the spbrtoc.xml file must also be updated in order to remove references to deleted folders.


The following powershell script will allow you remove backup files the are older than a specified number of days as well as update the spbrtoc.xml file for you.  (Items in bold will need to be edited for your file location and number of days)


# Location of spbrtoc.xml
$spbrtoc = “\\Servername\Backups\spbrtoc.xml
# Days of backup that will be remaining after backup cleanup.
$days = 7
# Import the Sharepoint backup report xml file
[xml]$sp = gc $spbrtoc
# Find the old backups in spbrtoc.xml
$old = $sp.SPBackupRestoreHistory.SPHistoryObject |
? { $_.SPStartTime -lt ((get-date).adddays(-$days)) }
if ($old -eq $Null) { write-host “No reports of backups older than $days days found in spbrtoc.xml.`nspbrtoc.xml isn’t changed and no files are removed.`n” ; break}
# Delete the old backups from the Sharepoint backup report xml file
$old | % { $sp.SPBackupRestoreHistory.RemoveChild($_) }
# Delete the physical folders in which the old backups were located
$old | % { Remove-Item $_.SPBackupDirectory -Recurse }
# Save the new Sharepoint backup report xml file
Write-host “Backup(s) entries older than $days days have been removed from spbrtoc.xml and harddisc.”

One you have created and saved the script (as a flie... CleanSPBackups.ps1 for example) you can either run manually or reference the script in a batch file to schedule and automate the cleanup process.

Cloning and Renaming a Server with SharePoint 2010

9. July 2013 10:38 by Matt in Information Technology Adventures  //  Tags: ,   //   Comments (0)

submit to reddit

It's starting to become popular to run SharePoint in a virtual environment. As a result, many systems administrators are taking snapshots and cloning existing SharePoint servers. That’s great from an IT administrative perspective. It allows you a lot of flexibility to quickly recover if something goes wrong, you need to make virtual hardware adjustments, or want a duplicate environment for testing purposes.  When carefully executed, you will have the ability to rename your server and retain a fully functional copy of your SharePoint site.

The First Step in the Process

  1. Duplicate the server
  2. Rename the server at the operating system level by using the System Properties dialog box in the Control Panel
  3. Restart the Server
  4. Ensure that any DNS entries are correct

Renaming a Server with SharePoint 2010

This process with use STSADM to rename the server

  1. Verify that you are a member of the local Administrators group on the local computer in order to run Stsadm.
  2. Open a cmd window AS ADMINISTRATOR (always do this whenever running stsadm commands – even if you are a local administrator)
  3. On the drive on which SharePoint Server 2010 is installed, change to the following directory: %COMMONPROGRAMFILES%\Microsoft shared\Web server extensions\14\Bin\
  4. Type the following command, and then press ENTER: stsadm -o renameserver -oldservername-newservername


Executing the above command will rename the server and notify you that alternate access mappings will need to be updated.

Reconfigure your SharePoint 2010 Alternate Access Mappings

In order to get SharePoint Features working with the new server (and SharePoint site) names, the alternate access mappings must be updated to the name of the new server. This can be done in the SharePoint Central Admin Site.

  1. Central Admin (use the URL with the new machine name) -> System Settings ->Configure Alternate Access Mappings
  2. Ensure that the alternate access mappings reflect the new name of the server.

At this point, a majority of SharePoint’s functionality will be functioning properly. Performance Point, SSRS, and Excel Services should all be working.

LinkedIn Subcribe to Our RSS Feed

Matt Gonzalez

Currently working as the IT Director for Vitech Corporation, a leading Systems Engineering solutions provider.  

I train at Gold's Gym 6 days a week with emphasis on the core lifts. (deadlifts, squats, and presses)