SPSite Restore Fails with “InvalidData” Error (Restore-SPSite PowerShell Fails)

One of my friend came up with the Error on PowerShell during a Restoration of SharePoint Granular Backup to another Farm.



Restore-SPSite : <nativehr>0x80070003</nativehr><nativestack></nativestack>

At line:1 char:1

+ Restore-SPSite http://Source-Site -Path C:\bkp\SourceSite.bak

-HostHeade …

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


+ CategoryInfo : InvalidData: (Microsoft.Share…dletRestoreSite: SPCmdletRestoreSite) [Restore-SPSite], DirectoryNotFoundException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite


After Checking all the Event Logs and Destination Databases etc.… realized that this cannot be an issue of the Destination Farm. Tried to backup the same Site Collection from source Farm via Central Admin Thrown an Failure at the end of the Backup job.


I Always Prefer PowerShell for SharePoint Administration because that’s the ultimate tool to get almost anything done when we stuck on UI. before finding the root cause for this failure through UI, made it to PowerShell since the Destination restoration was a urgent thing to do. If You face the same, Use Below Shell Line to Execute a Granular Site Collection Backup.

Backup-SPSite http://SourceSiteURL -Path "C:\site.bak"

This Ran very well and realized the size of the .bak file is pretty large than the one came out with errors through UI.

Used the New backup file to Restore and it went like a Charm. Making sure on the success result at the end of a backup job will save your day…

Extract Farm Solutions from SharePoint

Seems you are directed to here from a Search Engine!

Yes you can simply use PowerShell to extract your Farm solutions a bulk. there were some .exe s also does the same but for me it was more easy to use this smart little Shell Script. Every SharePoint Guy one day will face an Migration, this little guy is a very useful and reliable one.

Run PowerShell ISE as Admin and run below Lines. use first three Lines to Extract from the source Farm and last few lines are for Destination Farm use.

   1: #Extract Solutions from Source farm 

   2: Add-PSSnapin Microsoft.SharePoint.PowerShell

   3: $farm = Get-SPFarm

   4: $farm.Solutions | ForEach-Object{$_.SolutionFile.SaveAs("c:\export\" + $_.SolutionFile.name)}</p>


   6: #Add Solution to Another Farm 

   7: <p style="padding-left: 30px;">Add-PSSnapin Microsoft.SharePoint.PowerShell

   8: $files = Get-ChildItem "c:\install\"

   9: ForEach ($file in $files) {Add-SPSolution $file.FullName}

Sample (Change the ‘Save as’ Folder as you wish)