SharePoint 2010 and 2013 PowerShell Back-up Script
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:
- Download and save the zip file, extract it to a location on disk (c:\powershell\),
- Open the file with PowerShell ISE or Notepad and edit the file location and days variables and save the file,
- Create the UNC fileshare and share to the Farm Admin and SQL Service Account with full Write access,
- Make sure you have sufficient disk space,
- Open Windows Task Scheduler and create a new task,
- 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",
- Name the Task appropriately and click Actions and Add a New Action,
- Leave the Action on "Start a Program" and click browse and select the PowerShell.exe file (C:\Windows\System32\WindowsPowerShell\v1.0),
- In the Add Arguments "c:\powershell\backupspfarm_Cleanup.ps1" (This should be where you extracted the zip file to),
- 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),
- Test the script and schedule by clicking "Run" - (AFTER HOURS please),
- Check the back-ups daily,
- 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:
- It must be scheduled using windows task scheduler,
- It must be run as a Farm Administrator or Back-up Administrator account,
- A UNC file share location must be setup and shared,
- The SQL service account that is running the SQL Service where the SharePoint databases are, must have write access to the storage location,
- It must be checked for errors each day as part of your daily task list,
- 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)
- Changes to web.config and site customizations that are not deployed as part of a trusted or sandboxed solution.
- Settings in the SharePoint servers that are not included in a farm backup
- Certificates
- IIS metabase backup is not recommended
- Application pool account passwords
- HTTP compression settings
- Time-out settings
- Custom Internet Server Application Programming Interface (ISAPI) filters
- Computer domain membership
- Internet Protocol security (IPsec) settings
- Network load balancing (NLB) settings
- Secure sockets layer (SSL) certificates
- 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.
Comments
- Anonymous
January 01, 2003
SharePoint 2010 and 2013 PowerShell Back-up Script
thank you - Anonymous
January 21, 2015
Cloud to cloud backup for leading online SaaS application. SharePoint Online are very powerful cloud-based collaboration and storage services. It backup all or selected sites. For further details visit:
http://www.cloudally.com/?refId=ESA