ENTERPRISE

Using SharePoint 2010 Management PowerShell for Backup and Restore

2/21/2011 11:14:53 AM
SharePoint 2010 Management Shell built on Windows PowerShell is installed with SharePoint Foundation and SharePoint Server 2010. Although the STSADM command is available with SharePoint 2010, it has been deprecated to provide backward compatibility with previous versions. SharePoint 2010 administrators have now been armed with a powerful management shell to administer SharePoint 2010 environments. SharePoint 2010 Management Shell is far more powerful than SharePoint Central Administration and STSADM combined. SharePoint Central Administration is limited in functionality to what is represented in GUI, whereas SharePoint 2010 Management Shell is highly extensible with more than 600 prebuilt cmdlets available at the time of writing, in addition to support for creating custom cmdlet.

Backing Up the Farm Configuration Using PowerShell

To back up farm configuration using the SharePoint 2010 Management Shell, execute the following command from within the PowerShell Shell, as shown in Figure 1:

backup-spfarm –BackupMethod Full –Directory C:\Backup\ -ConfigurationOnly

Figure 1. Backing up the farm using PowerShell.

Backing Up an Entire Web Application

To back up a single web application using the SharePoint 2010 Management Shell, execute the following command, as shown in Figure 2:

backup-spfarm –BackupMethod Full –Directory C:\Backup\ -Item http://server

Figure 2. Backing up a web application using PowerShell.

Note

http://server is the name of the web application to be backed up using the Full method. If the web application is being backed up for the first time, it has to be full backup, or else the backup will fail in case of first-time differential backup.


The advantage of using Windows PowerShell is in executing multiple instances of Windows PowerShell scripts to back up site collections using the BackUpThreads parameter in backup-spfarm. The recommended value for SharePoint Foundation is 3 threads.

Restoring a Site Collection

To restore a single site collection using the SharePoint 2010 Management Shell, execute the following command, as shown in Figure 3:

Restore-SPSite –identity http://server/sites/it -path c:\backup\it\itbackup.bak –force


Figure 3. Restoring a site collection using PowerShell.

Note

We have used force to overwrite the site collection in the web application.


Import Site or List

To import a list within a site using the SharePoint 2010 Management Shell, execute the following command from within the PowerShell Shell:

Import-SPWeb –Identity http://servers/sites/IT/Announcements/ -Path C:\Backup\IT\Announcements.cmp –IncludeUserSecurity


The syntax for the Import-SPWeb command is shown in Figure 4.

Figure 4. Examining the syntax for the Import-SPWeb commandlet.

Importing a Site

Before you can import your web, you need to create the site. To create a site using the SharePoint 2010 Management Shell, perform the following steps:

Execute the following command from within the PowerShell Shell:

New-SPWeb –URL http://server/sites/IT/Blog/ -Verbose

Verbose parameter has been used to see how this cmdlet executes and creates a new site, as shown in Figure 5. After the site has been created, it can be overwritten with the backup using the following steps:

Figure 5. Creating a new site using New-SPWeb commandlet.

To import a site using the SharePoint 2010 Management Shell, execute the following command, as shown in Figure 6:

Import-SPWeb –Identity http://server/sites/IT/Blog/ -Path C:\Backup\IT\Blog.cmp –IncludeUserSecurity –UpdateVersions Overwrite


Figure 6. Importing a site using PowerShell.

With SharePoint 2010, backup and restore of site collections, sites, or lists can now be easily done with the Central Administration tool or SharePoint 2010 Management Shell. This functionality has been removed from SharePoint Designer 2010.

Other  
  •  Restoring SharePoint Using SharePoint Central Administration
  •  Windows Azure : Static reference data (part 2) - Performance disadvantages of a chatty interface & Caching static data
  •  Windows Azure : Static reference data (part 1) - Representing simple static data in SQL Azure & Representing simple static data in the Table service
  •  Performing Granular Backup Using the SharePoint Central Administration
  •  Using SharePoint Central Administration for Backup and Restore
  •  Backing Up and Restoring a SharePoint Environment : Using the Recycle Bin for Recovery
  •  Using Non-Windows Systems to Access Exchange Server 2010 : Understanding Other Non-Windows Client Access Methods
  •  Using Non-Windows Systems to Access Exchange Server 2010 : Remote Desktop Connection Client for Mac
  •  Using Non-Windows Systems to Access Exchange Server 2010 : Configuring and Implementing Entourage for the Mac
  •  Using Non-Windows Systems to Access Exchange Server 2010 : Mac Mail, iCal, and Address Book
  •  Parallel Programming with Microsoft .Net : Futures - Variations
  •  Parallel Programming with Microsoft .Net : Futures - Example: The Adatum Financial Dashboard
  •  Parallel Programming with Microsoft .Net : Futures - The Basics
  •  Using Non-Windows Systems to Access Exchange Server 2010 : Outlook Express
  •  Using Non-Windows Systems to Access Exchange Server 2010 : Understanding Non-Windows–Based Mail Client Options
  •  Deploying the Client for Microsoft Exchange Server 2010 : Deploying with Microsoft System Center Configuration Manager 2007
  •  Deploying the Client for Microsoft Exchange Server 2010 : Pushing Outlook Client Software with Group Policies
  •  Deploying the Client for Microsoft Exchange Server 2010 : Installing the Outlook Client for Exchange Server
  •  Deploying the Client for Microsoft Exchange Server 2010 : Preparing the Deployment
  •  Parallel Programming with Microsoft .Net : Parallel Aggregation - Design Notes
  •  
    Most View
    Programming Excel with VBA and .NET : Loops
    Windows 7 : Microsoft Deployment Toolkit 2010 - Creating and Populating a Deployment Share (part 1)
    SQL Server 2012 : Storage Systems (part 6) - Measuring Performance - Sequential Disk Access, File Layout, Flash Storage
    Portables Awards – Q1 2013
    Crucial Ballistix Tactical LP And Sport VLP Dual-Channel DDR3 Memory Kits Review (Part 2)
    Graphics Cards for All Budgets (Part 2) - Radeon HD 7770, GeForce GTX 560, Radeon HD 7850, GeForce GTX 660
    Windows Server 2003 : Domain Name System - The Split DNS Architecture
    11 Essential Outdoor Apps (Part 1)
    HTC First – Smartphone With Facebook Home (Part 4)
    Buying Guide: Gaming PCs For Hardcore Gamers' Dreams (Part 3) - Quiet PC Serenity Z77 Gamer, Vibox Juggernaut XL
    Top 10
    Sharepoint 2010 : Using InfoPath 2010 to Create Electronic Forms (part 2) - Publish the Form to a SharePoint Library
    Sharepoint 2010 : Using InfoPath 2010 to Create Electronic Forms (part 1) - Creating an InfoPath Form
    Sharepoint 2010 : Designing Workflows with Visio 2010 (part 2) - Importing the Workflow into SharePoint Designer
    Sharepoint 2010 : Designing Workflows with Visio 2010 (part 1) - Designing a Visio Workflow
    Windows Server 2003 : Supporting and Troubleshooting Terminal Server (part 5) - Managing User Sessions
    Windows Server 2003 : Supporting and Troubleshooting Terminal Server (part 4) - Managing and Troubleshooting Terminal Server - Device Redirection
    Windows Server 2003 : Supporting and Troubleshooting Terminal Server (part 3) - Managing and Troubleshooting Terminal Server - Connection Configuration
    Windows Server 2003 : Supporting and Troubleshooting Terminal Server (part 2) - Managing and Troubleshooting Terminal Server - Points of Administration
    Windows Server 2003 : Supporting and Troubleshooting Terminal Server (part 1) - Installing and Configuring a Terminal Server Environment
    Adobe Photoshop CS5 : Managing Color from Monitor to Print - Working with Rendering Intents