Convert from PBSC to HNSC

Recently I faced an issue that I created for myself when attempting to convert a path based site collection (PBSC) to a host named site collection (HNSC)


The situation was such that my PBSC was named and it had been created the good ole fashioned way, via the GUI, then modify the Alternate access mapping to read versus https://SEVERNAME:PORT, where SERVERNAME was something like 2013appw2k12 and port was 35089 or something (https://2013appw2k12:35089).

The world was great, the pbsc worked, and what not, but now it was time to re-architect the SharePoint so that it could scale. It was time to use Host Named Site Collections (HNSC’s).  After all, who wants to put all the company data in one database (prd_wss_content_portal2 or whathaveyou)?  The grand plan was that each division would have it’s own site collection someday.  Angels were singing and then….

What the H did I do wrong? <- – uses Arnold S. voice from Total recall and substitutes H for F, full clip here


Well, the first thing I did wrong was when I followed the advice given here

And here, I added my own step of not using a new name….doh!

Rather than follow the advice and use a new name, I tried to convert from its pbsc state to an hnsc and use the same name,

So I erroneously did

$uri = New-Object System.Uri(“”)
$site = Get-SPSite

Then end result is a database that still contains the site; but it does not work as an HNSC and SharePoint can’t see the site in the DB, even though it is still there.


I found this out after running get-spcontentdatabase, after having mounted the database to the HNSC web application.  In looking at the Manage Content Databases screen in Central Admin, it showed the database mounted, but the site count was a big fat scary zero!

To fix this, I dismounted the database and then remounted it to a newly created PBSC web application, using this DB when creating the PBSC.

I also made sure that in both cases the bindings in IIS were corrected.

If you follow the instructions the cake will turn out great

I followed the instructions and did something like this,

$site = Get-SPSite
$uri = New-Object System.Uri("")

And to get 100% success,  I followed the instructions to force the Content Database to refresh its site map with this:




Then, I mounted the DB to the HNSC web application, made sure the bindings and BackConnectionHostNames were good to go, and boom, success!!


Now all I have to do to get the to be is run Set-SPsite -URL, then double check bindings and back connection host names.