Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
1.5k views
in SharePoint Server by 66 69 85

I get the below issue when i restore SharePoint Site on PowerShell. I am trying to Restore my site in Sharepoint 2019 Management Shell, but I get this error:

"Restore-SPSite : The target site collection is a host header-based site collection, but a corresponding web application has not been specified. Please use the -hostheaderwebapplicationurl parameter and specify the web application."

The target site collection is a host header-based site

The Command:

Restore-SPSite -Identity myURL -Path "Backup Path" -Force 

I tried to use -hostheaderwebapplication parameter but still, the issue is not solved.

Sharepoint 2019 Management Shell is run as administrator.


1 Answer

0 like 0 dislike
by 159 198 381
selected by
 
Best answer

You got this error "The target site collection is a host header-based site collection, but a corresponding web application has not been specified. Please use the -hostheaderwebapplicationurl parameter and specify the web application.", because you are trying to restore a backup to a Host Name Site Collection that requires to specify the -hostheaderwebapplicationurl with the web application URL.

In your case, you have first to get which web application this site collection is a part of, then run the below restore cmdlet to restore the backup to the HNSC site collection

Restore-SPSite -Identity myURL -Path "Backup Path" -hostheaderwebapplicationurl  "Web Application URL" -Force 

Read more at Host-named site collection architecture and deployment in SharePoint Server

If you don’t ask, the answer is always NO!
...