Backup and Restore SharePoint 2010 Site Collection with PowerShell

You may also like...

24 Responses

  1. Larry W. Virden says:

    Thank you for the example. I presume that Windows SharePoint 2010 Management Shell is installed as part of the SP2010 installation?

    Also, how simple is it to use that Restore-SPSite to restore to a different farm, so that you can get in to recover just an item/list/document . I generally don’t want to restore an entire site to its original location.

    • You are correct, it is part of the SharePoint 2010 installation.

      The Restore-SPSite command is very simple to use. You are probably better off restoring to a secondary location if all you need is an item or document as you stated. Just restore to a DEV location and pull whatever you need from the site and delete it. Another option may be to just pull the document from the database backup if you have a backup of the content database. But removing contents from there can be a daunting task. Sounds like restore, copy files, delete site is probably the easiest route you will find.

      I have some code that will export the contents of the SharePoint content database, I will try to post it this week.It is in the form of an SSIS package.

  2. Saritha says:

    Hi Bradley – I am trying to retsore site collection ,I tried both Powershell and Stsadm but none worked for me.

    The command would throw an error – “The operation that you are attempting to perform cannot be completed successfully. No content databases in the web application were available to store your site collection. The existing content databases may have reached the maximum number of site collections, or be set to read-only, or be offline, or may already contain a copy of this site collection. Create another content database for the Web application and then try the operation again”.

    Please let me know how to proceed with this.

    thanks

    • Do you have a full install of SharePoint 2010 on that same server? You may need to specify the database using the appropriate parameter on the PowerShell script if the content for the web application is someplace other than the default databases. Are there other SharePoint site collections out there currently or will this be the first? If you are trying to overwrite the same site collection with a backup you will likely need to use the Force command along with the restore script. Hope this helps. Let me know if you continue to run into issues and maybe I could get you to send me a couple screen shots. Thanks for reading!

    • I actually just ran across this error myself this morning and after fumbling around for a little while I discovered that the content database was full, or in my case only had 20MB of space available and I was restoring a 200MB site collection. So in that case you can either make sure the database can grow beyond the size that it was, or in my case the drive was full and it was a DEV box that I needed the site collection on very quickly for something I was demoing so I created a second content database for the web application in Central Administration. Hope that helps.

  3. faisal says:

    bak up worked fr me

  4. Michael says:

    where does that actual snapshot get temporarily saved? On the db or on the server performing the script?

  5. dddd says:

    hay , it does not backup 14 hive content

  6. Manali says:

    thanks. it helped!
    Could you please tell what exactly will be deleted in “GradualDelete”

  7. Ravindra says:

    Its work fine in SharePoint 2013 also. Great article. Thanks

  8. Somanathan,TN, India says:

    HI

    I tried and it worked for me.

    Thnks..

  9. Hi Bradley,

    Nice write-up,

    you can get regular powershell to access the SharePoint cmdlets that the management shell has access by adding this line to your powershell profile or to your powershell session

    add-PSSnapin Microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

    Cheers,

  10. Madhulika says:

    Hello Mr. Bradley,

    I’m new to sharepoint and i have started learning and working with sharepoint since one week, My problem is i have deleted my top-level site unknowingly form the only site collection of my web application, So can the lost site be restored, I don’t know much about sharepoint, can u please help me to restore my site with simple steps.

    Thanks…

  11. EL FIGHA says:

    In some cases, this method d’ont work
    For example, if you try to restore a .bak file from a version n of sharepoit to version n+1 ….
    Sharepoint is the very bad software I never seen

  12. riyaaz says:

    Madhulika, just restore the SQL database

  13. durga says:

    kjgjgjghkjhghghj

  1. August 11, 2011

    […] a little out of the ordinary… I am posting about PowerShell. I have done one previously about Backing up and restoring site collection in SharePoint, so believe me I will admit that it has its place.  Well I was onsite with a client today and […]

  2. January 4, 2012

    […] site collection can be a pretty easy task.  If your interested in how to do that check this blog (Backup and Restore SharePoint 2010 Site Collection With PowerShell) where I explain the process. Unfortunately this is not always a foolproof process as I have […]

  3. October 29, 2013
  4. January 21, 2015

    […] Backup and Restore SharePoint 2010 Site Collection with … – One of the most annoying processes with SharePoint is backing up a site collection. There is a build in tool that you can use but it is kinda clunky and can take a …… […]

  5. July 24, 2015

    […] is a little out of the ordinary… I am posting about PowerShell. I have done one previously about Backing up and restoring site collection in SharePoint, so believe me I will admit that it has its place.  Well I was onsite with a client today and […]

  6. October 14, 2015

    […] site collection can be a pretty easy task.  If your interested in how to do that check this blog (Backup and Restore SharePoint 2010 Site Collection With PowerShell) where I explain the process. Unfortunately this is not always a foolproof process as I have […]

Leave a Reply