Monday 10 September 2012

Granular restore using CMDlets in sharepoint 2010

Granular restore using CMDlets in sharepoint 2010
This one is a very simple task, if you have ever come into work one day and your sharepoint server has decided to crap itself (Its a Microsoft Product they usually do at some point), you may need to do a command line restore of your backups
Login to your Sharepoint server via RDP or if you can get to the terminal itself then jump on the keyboard and open up the Sharepoint 2010 Management Shell.

Type the following text into the CLI (restore-spsite -identity http://site to restore to -path \\the backup file you want to restore.bak)

Then Press the Enter Key
You will be asked to Overwrite the existing site that is currently there Choose Y and hit enter

More than likely it will come back with an error stating that the site already exists and cant be overwritten like the image below

What we need to do is force the overwrite to do this simeply add -F to the end of the script like below
restore-spsite -identity http://site to restore to -path \\the backup file you want to restore.bak -F and press Enter

It will then ask you to Overwrite again so press Y and Enter again and the restore will start

It will take a while if you sharepoint sites are pretty large like mine are, just leave the window open in the background and when it has finished it will tell you as per the image below.

No comments:

Post a Comment