Using the following code I should be able to access the Taxonomy Term Stores:

$site = new-object Microsoft.SharePoint.SPSite("http://localhost")
$session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)

Yet the TermStore count is always 0. I know I have Term Stores and Term Groups and Terms because I'm able to tag items using the terms and view them in the Term Store Management Tool. For the SPSite I have tried localhost, the actual computer name, and even the Central Admin site.

Based on my research this shouldn't be that difficult.





Can you please spot what I'm doing wrong?

3 Answers 3


My Managed Metadata Application Proxy was not a part of the default proxy group. After running the following command $session.TermStores.Count now returns 1! Yay!

Set-SPMetadataServiceApplicationProxy -Identity "Metadata Service Application Proxy" -DefaultProxyGroup
  • Please note, the comments here (regarding Application Proxy and Permissions) worked for me only after I rebooted my machine. Commented Mar 6, 2012 at 20:36

The account you are running powershell may not have permission - you will notice that the session lists the service as offline. Check the Administrators for Metadata Service Application and also check Connection Permissions for Metadata Service Application (which is what fixed it for me).


If you look at the second MSDN link you listed, you'll see that the example pulls the session's TermsStores object into a TermStoreCollection and checks the count from there. I wonder if that would solve your problem...

  • That's a good point. Unfortunately getting a reference to the TermStoreCollection still results in 0 entries. $site = new-object Microsoft.SharePoint.SPSite("localhost") $session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site) $stores = $session.TermStores $stores.count 0
    – Corbett
    Commented Jul 19, 2010 at 12:41
  • This guy is having the same trouble: go4answers.com/Example/…. What URL does the TaxonomySession's site need to be? Central Admin?
    – Corbett
    Commented Jul 19, 2010 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.