Answered by:
PowerShell to backup farm configuration

Question
-
Hi everybody,
I have used the Backup-SPSite command to backup the site collections and that works OK. Actually I am using the following script http://bradcote.wordpress.com/2012/05/02/powershell-script-to-backup-site-collections/ to backup all site collections and that works OK.
But what PowerShell command do I need to use in order to backup farm configuration (AdminContentDB, ConfigDB, Search SA, UPS, etc)? I do not want to do this from CA.
As far as I know Backup-SPFarm will backup complete farm and that is not exactly what I want. I would to have the backups per site collection (what I already achiever) and backup of farm configuration.
The idea behind this is to be able to restore:
a) In case someone screwed up the environment by updating a farm solution(with master pages) and changing security or content in site collection
b) In case someone screwed up Service Application
c) In case someone screwed up Alternate Access Mappings
Thanks in advance!
Tofig
- Edited by Tofig Wednesday, October 3, 2012 12:08 PM
Wednesday, October 3, 2012 12:06 PM
Answers
-
I think what you're really looking for is this:
Backup-SPConfigurationDatabaseAlternatively, you could use:
Backup-SPFarmIf you use Backup-SPFarm, you would need to specify the -ConfigurationOnly switch
Both options should get you your solution store, web application settings (not alternate access mappings), farm level configuration settings, etc.
Hope that helps.
Roger Cormier
Microsoft
Blog: http://blogs.msdn.com/b/rcormier/
Premier Field Engineer, SharePoint
Twitter:LinkedIn:
Note: My posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
- Proposed as answer by Roger CormierMicrosoft employee Wednesday, October 3, 2012 9:36 PM
- Marked as answer by Kelly Chen 2012 Thursday, October 11, 2012 10:06 AM
- Unmarked as answer by Tofig Friday, October 19, 2012 10:59 PM
- Marked as answer by Tofig Wednesday, June 5, 2013 8:56 PM
Wednesday, October 3, 2012 8:42 PM
All replies
-
That's the purpose of the farm backup. It backs up the configurations (some exceptions apply) and content. It used to be called the "catastrophic backup" because it was to be used when a catastrophe hit your farm (natural disaster, hardware failure, overzealous admin).
However, the farm backup only gets as granular as backing up content databases, so unless each site collection is in its own database you cannot use it to restore a single site collection.
Wednesday, October 3, 2012 1:01 PM -
I think what you're really looking for is this:
Backup-SPConfigurationDatabaseAlternatively, you could use:
Backup-SPFarmIf you use Backup-SPFarm, you would need to specify the -ConfigurationOnly switch
Both options should get you your solution store, web application settings (not alternate access mappings), farm level configuration settings, etc.
Hope that helps.
Roger Cormier
Microsoft
Blog: http://blogs.msdn.com/b/rcormier/
Premier Field Engineer, SharePoint
Twitter:LinkedIn:
Note: My posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
- Proposed as answer by Roger CormierMicrosoft employee Wednesday, October 3, 2012 9:36 PM
- Marked as answer by Kelly Chen 2012 Thursday, October 11, 2012 10:06 AM
- Unmarked as answer by Tofig Friday, October 19, 2012 10:59 PM
- Marked as answer by Tofig Wednesday, June 5, 2013 8:56 PM
Wednesday, October 3, 2012 8:42 PM -
Everyone thanks for your posts!
Roger:
What I am looking for is a backup of all farm settings but not the data. Can you confirm that Backup-SPConfigurationDatabase either Backup-SPFarm -ConfigurationOnly will do that? I need AdminContentDB, ConfigDB, all service applications(Search SA, UPS, etc), topology, services and etc., but not the data.
In your message above you said "Both options should get you your solution store, web application settings (not alternate access mappings), farm level configuration settings, etc." But I was not sure that it will include all those or will I need to redistribute the services and make some manual adjustments...
Additionaly you say that alternate access mappings wont be backed up. Is there something else that will not be backed up using this command?
Tofig
Friday, October 19, 2012 11:10 PM -
This will back up the farm configuration, without the data. That also means that your central administration content database will not be included in the backup. This hopefully shouldn't be much of an issue, because you really shouldn't be storing any data in your central administration content database.
Your alternate access mappings is pretty much going to be the only thing you'll notice will be missing. Your default zone will be fine, it may even give you the alternate access mappings themselves (that I'm not 100% sure of), but the IIS bindings for those alternate access mappings will not be put back in place. Any manual changes you had to make in the web.config files (hopefully you didn't have to make any because they were included in your solutions) will also not be put back in. Basically, anything you had to do manually in your farm, and not through the SharePoint UI would have to be redone.
Roger Cormier
Microsoft
Blog: http://blogs.msdn.com/b/rcormier/
Premier Field Engineer, SharePoint
Twitter:LinkedIn:
Note: My posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Saturday, October 20, 2012 2:39 AM -
Thank you for your clarification Roger!
It is almost clear:)- I did not make any manual changes to IIS and the only thing I added to Alternate Access Mappings is load balanced url for SharePoint Central Admin site. Also I changed port of SharePoint Central Admin to port 80 using stsadm -o setadminport -port 80 command. I guess I might need to reapply those if I restore on new infrastructure and won’t have to reapply if I restore on existing infrastructure. Am I right?
- As for your remark "central administration content database will not be included in the backup", how do I backup that one? As far as I know Get-SPSite does not returns CA site collection, so I guess I will not be able to use Backup-SPSite to backup CA site collection either. How do I do that?
- Will Restore-SPFarm –ConfigurationOnly also create WebApplications if I am restoring on new infrastructure either overwrite the WebApplications when restoring on existing infrastructure(for example when I restore because WebApplication get damaged)? I mean all WebApplications for data (publishing portal, team sites portal, my sites) as well as WebApplication for Central Admin. If it only restores the contents saved in config database and not recreates/updates WebApplications, what do I do with WebApplications, how do I fix those? In real life I will not be able to re-create them manually 100% same as they were before; probably I won't know exact name, url, database name, settings and etc...
- Can I use something like Restore-SPFarm –Directory \\App01\SharePointBackups -RestoreMethod New –Item "Excel Services" to restore only Excel Services from the backup made by Backup-SPFarm –ConfigurationOnly command or is the only restore posibility to restore the complete configuration by somtehing like Restore-SPFarm –ConfigurationOnly?
Thanks in advance!
Tofig
- Edited by Tofig Thursday, October 25, 2012 3:38 PM
Thursday, October 25, 2012 3:37 PM -
First - Yes... You will probably need to add the load balanced alternate access mapping for central administration
Second - I'm having a little bit of a hard time understanding this. What exactly are you storing in Central administration that needs to be backed up, and why? I've seen a handful of people creating lists and libraries in Central administration, I've just never seen any good reasons for doing this.
Third - Yes, it will create your web applications. If all of the databases are in place as well, the web applications will even be functional. Effectively, the configuration database contains information about all of the building blocks that represent your farm.
Fourth - You don't have to restore the entire configuration backup. It works like other farm backups, whereas you can select individual components to restore the configuration, if it is needed.
Roger Cormier
Microsoft
Blog: http://blogs.msdn.com/b/rcormier/
Premier Field Engineer, SharePoint
Twitter:LinkedIn:
Note: My posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Thursday, October 25, 2012 7:57 PM -
coming back to this post.
luckily I had not required this yet :)You mentioned that Restore-SPFarm –ConfigurationOnly will create or recreate WebApplications.
So if I am restoring on existing infrastructure WebApplication configuration and farm featured will be overwritten. This part is clear, but what happens to content database; new empty content database created or old one(with data) kept untouched?
Also interesting to know what happens with content databases when am restoring on new infrastructure; will new WebApplication created with empty content database or WA with no content database at all?
I assume in any of these cases it is still possible to use sql restore to restore content database and attach it to WA, right?
Tofig
Wednesday, June 5, 2013 9:17 PM