MSTechSA

An online channel to share in-depth technical information about current and future product solutions within the Microsoft stack that impacts all IT Professionals in South Africa.

SharePoint 2010 and 2013 PowerShell Back-up Script

SharePoint 2010 and 2013 PowerShell Back-up Script

  • Comments 1
  • Likes

I have been asked several times for a Farm backup script and I have been meaning to get to it, so finally here is one I use frequently.

The attached script is one I accumulated through details from various online sources so this blog is designed to be an instructional overview from those posts.

I can obviously not take responsibility for any errors or issues with the script - please read the instructions carefully.

This script has a DAYS ($days variable) setting so you can configure it for how many days back-up you would like to keep and it will delete the old back-ups off disk and also remove them from SharePoint Back-up history as well.....AWESOME.

Steps to get this script running:

  1. Download and save the zip file, extract it to a location on disk (c:\powershell\),
  2. Open the file with PowerShell ISE or Notepad and edit the file location and days variables and save the file,
  3. Create the UNC fileshare and share to the Farm Admin and SQL Service Account with full Write access,
  4. Make sure you have sufficient disk space,
  5. Open Windows Task Scheduler and create a new task,
  6. Make sure that you run the task as a Farm Admin or Back-Up admin account and tick the box "Run whether user is not logged on or not",
  7. Name the Task appropriately and click Actions and Add a New Action,
  8. Leave the Action on "Start a Program" and click browse and select the PowerShell.exe file (C:\Windows\System32\WindowsPowerShell\v1.0),
  9. In the Add Arguments "c:\powershell\backupspfarm_Cleanup.ps1" (This should be where you extracted the zip file to),
  10. Click ok and then click Triggers and set how frequently you want this to run (AFTER HOURS as it has impact on the Farm Performance),
  11. Test the script and schedule by clicking "Run" - (AFTER HOURS please),
  12. Check the back-ups daily,
  13. Use a back-up tool to send the required back-ups to tape for archiving purposes.

NB: A back-up is only as good as it's first restore so test the back-up. (On a TEST server)

 A few key points to remember about a Full  SharePoint Farm Backup:

  1. It must be scheduled using windows task scheduler,
  2. It must be run as a Farm Administrator or Back-up Administrator account,
  3. A UNC file share location must be setup and shared,
  4. The SQL service account that is running the SQL Service where the SharePoint databases are, must have write access to the storage location,
  5. It must be checked for errors each day as part of your daily task list,
  6. A full farm backup is a last recovery resort i.e. it is used when no other options are available and is considered a critical recovery component
    Some constraints of a Full Farm Backup below: (All of the details below are not part of SharePoint which is why they are excluded)
  1. Changes to web.config and site customizations that are not deployed as part of a trusted or sandboxed solution.
  2. Settings in the SharePoint servers that are not included in a farm backup
  3. Certificates
  4. IIS metabase backup is not recommended
  5. Application pool account passwords
  6. HTTP compression settings
  7. Time-out settings
  8. Custom Internet Server Application Programming Interface (ISAPI) filters
  9. Computer domain membership
  10. Internet Protocol security (IPsec) settings
  11. Network load balancing (NLB) settings
  12. Secure sockets layer (SSL) certificates
  13. Dedicated IP address settings

A full Farm restore does not put all of the Service Applications and proxies back and does not link them to their proxy group so there are manual steps that need to be taken (Hopefully I will get a chance to cover that in another blog).

To compliment your back-up and effectively back-up your server use BareMetal.

Attachment: backupspfarm_Cleanup.zip
Comments
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment