A continuación les comparto un script para republicar content types desde un Content Type Hub. Esto resulta útil en pases a producción donde se lleva un backup completo del content type hub y del site collection de la solución a restaurar.
El script lo obtuve de esta página: http://get-spscripts.com/2010/11/republish-all-hub-content-types-in.html se las recomiendo pues tiene muchos ejemplos interesantes del uso de PowerShell para SharePoint.
function Republish-HubContentTypes ($CTHubURL)
{
#Get Content Type site and web objects
$ctHubSite = Get-SPSite $CTHubURL
$ctHubWeb = $ctHubSite.RootWeb
#Check the site is a content type hub
if ([Microsoft.SharePoint.Taxonomy.ContentTypeSync.ContentTypePublisher]::IsContentTypeSharingEnabled($ctHubSite))
{
#Set up ContentTypePublisher object to allow publishing through the Content Type Hub site
$spCTPublish = New-Object Microsoft.SharePoint.Taxonomy.ContentTypeSync.ContentTypePublisher ($ctHubSite)
#Step through each content type in the content type hub
$ctHubWeb.ContentTypes | Sort-Object Name | ForEach-Object {
#Has the content type been published?
if ($spCTPublish.IsPublished($_))
{
#Republish content type
$spCTPublish.Publish($_)
write-host «Content type» $_.Name «has been republished» -foregroundcolor Green
}
else
{
write-host «Content type» $_.Name «is not a published content type»
}
}
}
else
{
write-host $CTHubURL «is not a content type hub site»
}
#Dispose of site and web objects
$ctHubWeb.Dispose()
$ctHubSite.Dispose()
}
#Republicar Content Types del content type hub
Republish-HubContentTypes -CTHubURL http://miportal/soluciones/contenttypehub