Friday, 19 November 2010

Republish all hub content types in SharePoint using PowerShell

The idea for this script came in as a request from an anonymous comment I received yesterday on an earlier post showing how to push changes from a content type hub site to site collections using PowerShell.

The script in this article steps through each content type in a content type hub and republishes any that have been previously published. Once you specify the content type hub URL, the script performs the following tasks:

  • Checks to see if the URL specified is a content type hub site
  • Enumerates through each site content type in the hub and:
    • Checks if the content type has been previously published
    • If it has, republish it and write a success message to the console
    • If it hasn’t, write a message to the console confirming it is not a published content type

To use it, run this script first:

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
                write-host "Content type" $_.Name "has been republished" -foregroundcolor Green
                write-host "Content type" $_.Name "is not a published content type"
        write-host $CTHubURL "is not a content type hub site"
    #Dispose of site and web objects

Once run, you can call the script by typing the following command:

Republish-HubContentTypes –CTHubURL <ContentTypeHubURL>

For example, type the following command to republish all content types in a hub site with the URL http://portal/sites/CTHub:

Republish-HubContentTypes -CTHubURL http://portal/sites/CTHub

An example output from the script is shown below:



  1. this is perfect for what i needed to do today, thank you for posting it.

    1. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the authors explore the idea of using Java in Big Data platforms.

      Spring Training in Chennai

      The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

  2. It's a pleasure Jeff - thanks for saying "thanks" :)

  3. Hi Phil,

    I am trying to excute the above the script but iam getting below .

    "Exception calling "Publish" with "1" argument(s): "The operation failed on one or more Metadata web service application proxies: Metadata Service Application"

    Any help on the above issue would be higly appriciated.

  4. I also faced the samie issue, open the powershell with runas administrator.

  5. Great example, thank you.

  6. You are a hero - thanx

  7. I was just about to write this. You saved me a lot of time. Thanks loads.

    I like the check to see if it has been published before too.

  8. Also had the "Exception calling "Publish" with "1" argument(s): "The operation failed on one or more Metadata web service application proxies: Metadata Service Application" Error.

    And RunAs Administrator did not solve it.

    Any ideas anyone...

    1. For those of you getting the error:
      "Exception calling "Publish" with "1" argument(s): "The operation failed on one or more Metadata web service application proxies: Metadata Service Application"

      And the ULS report errors for powershell.exe such as:
      Metadata web service application proxy Managed Metadata Service Proxy is not in a working state. Skip it.

      I had this error - and solved it by running the script on a server where "Managed Metadata Web Service" was started
      CA -> System -> Manage services on server (if this is not visible, launch IE as admin)

  9. Just what I needed as well, only I had a very "funny" (frustrating) issue. The published content types would get published to the subscribing site, only without their names.. Have to manually go in and press publish through the UI.

  10. I wrote a similar function to yours: I get my content types by filtering on the group names . One thing I found is for each new Content type you need to do an initial publish say with the UI . Otherwise you get your else clause.-

  11. Thanks For Your valuable posting, it was very informative. Am working in Erp Software Company In India

  12. I am happy to see this post.Thank you for sharing the great information.ERP in chennai

  13. 2016 was filled with more Air Jordan 12 releases than we could handle, and there’s actually still a couple Jordan 11 more dropping before the end of the year. What we didn’t see was any low-top versions of the Air Jordan 12 hit retailers.If you happen to be a fan Jordan Shoes 2016 of the 12 Low then the good news for you is that Jordan Brand plans on releasing a few different colorways in 2017 with one of them being previewed Jordan 7 Tinker Alternate for the first time up above. This Air Jordan 12 Low features a vibrant red suede all throughout the upper with black accents placed on the inner liner, laces, Jordan 13 Shoes mudguard, upper eyelets, heel tab, branding, and the back of the midsole. A red outsole wraps up the look.No exact release date is known yet for the Air Jordan Jordan Shoes 12 Low Red Suede but it is expected to release some time in 2017. Make sure you stay tuned to Kicks On Fire for updates.
    A woolen version of Jordans for sale the Air Jordan 11 is expected to be offered this year as part of JB’s standout Holiday 2016 lineup, which will join alongside the return of the iconic Air Cheap Jordans Jordan 11 Space Jam.As suggested, the basketball sneaker will host a wool constructed upper, which will essentially be similar to the upcoming AJ 3 Wool and AJ 12 Wool Kobe Bryant Shoes renditions as well. Dark grey and black comprises the model’s upper, while a white midsole unit and translucent outsole finishes off the more functional and premium profile.
    It Jordan 13 doesn’t get much more official than this. If you had any doubts that the Air Jordan 11 Space Jam would be returning this year then you can put those Jordan Eclipse doubts to rest as Nike has now given us our first official look at the highly anticipated release.Part of Nike’s “12 Soles” Collection that will be dropping in December, Kyrie Shoes the Air Jordan 11 Space Jam will come with an OG look as it features a higher patent leather cut in comparison to the last couple of releases.

  14. [url=][b]adidas yeezy boost 350[/b][/url]
    [url=][b]coach outlet online[/b][/url]
    [url=][b]moncler jackets[/b][/url]
    [url=][b]stan smith adidas[/b][/url]
    [url=][b]adidas uk[/b][/url]
    [url=][b]toms outlet[/b][/url]
    [url=][b]pandora charms sale clearance[/b][/url]
    [url=][b]michael kors outlet clearance[/b][/url]
    [url=][b]coach outlet store online[/b][/url]

  15. There are a lot of alternatives that can be used when it comes to writing quality content for our website and by not just using an article writing software.spin rewriter review

  16. Nice article, I loved it. Thanks for sharing and keep sharing.

  17. Your website content nice nice and interesting to observe.
    jobbörse Neunkirchen

  18. Is there a way to re-publish individual content types or perhaps a content type group?

  19. It is great to have visited your website. Thanks for sharing useful information. And also visit my website about health. God willing it will be useful too

    Pengobatan Scabies secara Alami
    Obat Penghilang Jerawat dan Bekasnya
    Cara Menyembuhkan Batuk Berkepanjangan

  20. Hey, Wow Provided Post will be Very much Informative to the People Who Visit this Site. Good Work! Thank You for Sharing.
    Education erp software in chennai

  21. También puede visitar una tienda de ladrillo y mortero de Michael Kors o su sitio web y comprar directamente un bolso Michael Kors desde allí. Usar un bolso de Michael Kors les permite a los demás reconocer que el habitante urbano educado toma la moda realmente con seriedad. Los bolsos de hombro son particularmente refinados y elegantes.

    {Bolsas Michael Kors Precios | Bolsos Michael Kors Outlet | Michael Kors Rebajas}

    En vacker konstnärlig skapelse av vävt läder, som ger ett skalskaligt utseende - liknar en snakeskin eller fiskhud, linjer utsidan av påsen. Läderens bältros är små läderringar. Det finns också gyllene accenter på väskan. Slutresultatet är svagt liknar kedjepost.

    {Michael Kors Rea | Michael Kors Väska Rea | Michael Kors Plånbok}

  22. Amazing Article ! I have bookmarked this article page as i received good information from this. All the best for the upcoming articles. I will be waiting for your new articles. Thank You ! Kindly Visit Us @ Coimbatore Travels | Ooty Travels | Coimbatore Airport Taxi | Coimbatore taxi

  23. Are you blacklisted? Struggling to get a personal loan? Has your application been DECLINED due to Low Credit Score? Over COMMITTED? Affordability? But you know you can afford this loan. Loans Approved in 4hours, you can email us at

    Loan Amount Needed:
    Loan Duration:
    Your Country:
    Mobile NO:
    Purpose Of Loan:
    Email Address:
    monthly income:

    Opportunity Financial, LLC

  24. Information from this blog is very useful for me, am very happy to read this blog Kindly visit us @ Luxury Watch Box | Shoe Box Manufacturer |  Candle Packaging Boxes | Wallet Box

  25. A beautiful purse or handbag from Coach Outlet Online can last for many years, and represent a great overall value.
    There are Michael Kors Bags Outlet in a large number of shopping malls located throughout the country.
    Cheap Michael Kors Bags is a great way to determine which models best suit your needs.
    Official Coach Factory Outlet Online all strive to provide comfort and convenience for their owners and the seams are double-stitched for maximum durability.
    Michael Kors Factory Store, has one of the most popular handbag and accessory lines on the market today.
    Coach Handbags Wholesale says a lady is classy, elegant and sophisticated.
    Coach Store Near Me trends come and go, but a Coach stands the test of time.
    The official Michael Kors Handbags On Sale Outlet regularly posts various handbags being offered for sale.
    Compare your Coach Bags On Sale Outlet to the logo provided on the website to make sure it is similar.
    All Michael Kors Outlet Online Store have serial numbers.

  26. No matter what type of Michael Kors Bags Outlet each individual got, they all had one thing in common. We all know that getting something on sale is like winning a mini lottery, but to find a name brand handbag like Michael Kors Black Friday Sale for instance, discounted is like a slice of heaven on earth. I have personally attacked my husband with hugs and kisses when finding Official Coach Outlet Online at discounted prices.

    Michael Kors Factory Outlet stores can be found in malls all over. MK Outlet and other Coach merchandise can also be found in some boutiques. Inspired by the same material baseball gloves are made from, these Coach Bags On Sale Online are versatile and stylish. Since it's conception, the Michael Kors Handbags Outlet has been produced into a variety of designs, colors, shapes, and styles that have won top pick of millions of women the world over.

    New Michael Kors Bags are the most sought after handbag. Since Coach Outlet Online is one of the most recognized name brands in the world of fashion, you will find A-list celebrities down to small girls wearing them.

    tags:Coach Outlet|Coach Bags Factory Outlet|Coach Purses Outlet

  27. The primary casings in order to engineered would be a ft safeguard the settlers and the backyard regarding Van Riebeeck placed to provide cruises of the corporate simply because they visited spine having patio craps room patio furniture clean. Entrances pleaded sinful opposite a tell in oregon on Friday plus known this individual took part in financial wrongdoings having henry Manafort.

    The content is generally larger in comparison with what tights, Which is the reason why them doing physical exercise jeans rather than just stockings.. People anywhere had victory and equates to otherwise is much greater than $600 regarding; Typically all these receiver should really and additionally a W 9 taxation form and still provide one particular variety identity(License, Social safeguarding memory phone visa piece of plastic, Voters signing up, Or some different kind of landscape i. (tags: Coach Outlet Store Online, Cheap Real Yeezys, Jordan Shoes For Sale, Ray Ban Sunglasses Outlet)

    Their property had been a getaway your Hagel jungs.. The cost of FreedomAmericans through WarOne of the actual biggest reveals, And very sobering, Is now online third fl. NHL 2019. Trying defend youngsters with obscure or possibly a imprecise points can become unease, Confusion and stress, Additionally distrust.Young little ones will have enquiries looking for a pet is used up, Consists of: As to the reasons may my very own pet perish? That could be excellent shortcoming? That executes a family pet technique opt? Can i do you ever in the future get your pet ever once? Considerably more than simply desire complex and therefore 'm truly good may i yield the best pet returning? Can fatality remaining for keeps? You must answer these kind of pros and cons very easily, But nonetheless, genuinely.Your the minors may feel dismay, Tempers, Fear and anxiety, Refusal, As well as sense of guiltiness if her or his pet is used up (tags: Michael Kors Purses Outlet, Coach Bags Clearance, Cheap Yeezy Shoes, Yeezy Boost 360).

  28. PG SLOT มีเกมหลากหลายให ้เลือก พรอ้ มกราฟฟิกแอนนเิมชนั่ สวยงามทสี่ ดุ ในยคุ นี้แจ็คพอตแตกง่าย pgslot โปรโมชนั่ พเิศษส าหรับทงั้สมาชก เกา่ และสมาชกิ ใหม่ ระบบฝาก-ถอนเงินออโต ้เงินเข ้าเร็วทันใจมีแอดมิ ดูแลตลอด 24 ชวั่ โมง ต ้องที่ มั่นคงจ่ายจริง ไม่ว่าคุณจะถอนเงิ มากมายเท่าไหร่ ทางเว็บจ่ายเต็มไม่มีหัก pgslot ปั่นง่ายแตกง่าย ทางเขา pg slot

    PG SLOT ผู ้ให ้บริการเว็บตรง ที่แตกง่ายที่สุด ปั่นสนุก ฝากเงินรับเครดิตฟร สูงสุด 15000 บาท สมัคร พีจีสล็อต หรือ PGSLOT กับเราเพื่อความมั่นคงของคุณเอง.