Restoring to a host name site collection (SharePoint 2013)

In PowerShell, SharePoint 2013 by rhodzyLeave a Comment

When backing up a SharePoint site and restoring to a HNSC (Host name site collection) the command is slightly different. You have to specify the web application and also the database that the HNSC sits in. 

For example:

Restore-SPSite http://mysite -Path E:\TEMP\mysite.bak -force -HostHeaderWebApplication http://mywebapp -DatabaseName MySharePointDatabase

The above command will restore the mysite.bak file to the URL http://mysite which sits on the mywebapp webapp within the MySharePointDatabase.