This blog post is a guide on how to create a Content Type Hub Site Collection located in the root of a Web Application within its own database.
Create a Content Type Hub Database
I like to have my Content Type Hub Site Collection in its own database. Here is the code/example to create a database for the content type hub.
Example
$CTHDBName = “ContentTypeHub_DB”
$WebApplicationURL = “http://SharePointRandy/”
New-SPContentDatabase -Name ContentTypeHub_DB -WebApplication $WebApplicationURL
Further reading http://technet.microsoft.com/en-us/library/ff607572.aspx
Create a Managed Path
As I want my Content Type Hub to be at the root of my Web Application (http://<webapplication>/contenttypehub) I need to create a managed path. The PowerShell to do this is here:
Example
$RelativeURL = “/ContentTypeHub”
$WebApplicationURL = “http://SharePointRandy/”
New-SPManagedPath -RelativeURL $RelativeURL -WebApplication $WebApplicationURL
-Explicit
Further reading http://technet.microsoft.com/en-us/library/ff607693.aspx
Create Content Type Hub Site Collection
It is easy to create a Content Database through the GUI but to ensure it is located in the database just created it is easier to do in PowerShell with the –ContentDatabase Parameter.
Example
$CTHurl = “http://SharePointRandy/ContentTypeHub”
$CTHOwnerAlias = “<domain>\<user>”
$CTHTemplate = “STS#1″
$CTHDBName = “ContentTypeHub_DB”
New-SPSite -Url $CTHurl -OwnerAlias $CTHOwnerAlias -Template $CTHTemplate -ContentDatabase $CTHDBName
Further reading http://technet.microsoft.com/en-us/library/ff607937.aspx
As I don’t want to use the Content Type Hub Site Collection for anything else I like to prevent further Site Collections being created in the Content Type Hub database. To do this, run the following PowerShell:
Example
$CTHDBName = ContentTypeHub_DB
Set-SPContentDatabase -Identity $CTHDBName -Status Offline
Further reading http://technet.microsoft.com/en-us/library/ff607912.aspx
Activate Content Type Syndication Hub
You need to activate the Content Type Syndication Hub feature to allow the Managed Metadata Service Application to connect to the Content Type Hub Site Collection.
$CTHurl = “http://SharePointRandy/ContentTypeHub”
Enable-SPFeature -Identity 9a447926-5937-44cb-857a-d3829301c73b -Url $CTHurl
Connect the Managed Metadata Service Application to the Content Type Hub
To connect the Managed Metadata Service Application to the Content Type Hub you need to use the command Set-SPMetadataServiceApplication. I’ll explain this in another blog post but for now see: http://technet.microsoft.com/en-us/library/ff607738.aspx


