0

I have a Web App with a root and four different HNSCs. I've been able to successfully backup and restore the HNSCs from a dev environment, but I am having trouble achieving this with my root site collection.

This is my PowerShell script:

Restore-SPSite http://contoso.com/ -Path xxx.bak -DatabaseServer xxx -DatabaseName xxx -HostHeaderWebApplication http://contoso.com -Force

I get the following error:

Restore-SPSite : The URL 'http://contoso.com/' is in use as an alternate access URL or as the URL of a host header site.  Please choose a different URL and try again.

I tried removing the existing root site collection before running the script with the same outcome. I even tried using / as the Site Collection's url with no success.

Microsoft examples are for site collections under sites, not root site collections. So, is this even possible?

  • Is root level site collection is hnsc? If you go central admin> view all site collections under the Web app check what is the url of "/" site collection – Waqas Sarwar MVP Jun 8 '15 at 21:39
  • @WaqasSarwarMCSE Same as the Web App's url: http:// contoso.com – Gonzalo Jun 8 '15 at 23:09
  • 1
    Try to run the command without host header parameter? – Waqas Sarwar MVP Jun 8 '15 at 23:12
  • Great, I added that into as answer for other benifit as well as for some rewards. – Waqas Sarwar MVP Jun 8 '15 at 23:26
1

Because you are trying to restore a site collection, I would remove the host headerwebapplication url from coomand i.e

Restore-SPSite http://contoso.com/ -Path xxx.bak -DatabaseServer xxx -DatabaseName xxx  -Force

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.