SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 6 down vote accepted

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
share|improve this answer
Thanks for following up! – Rob Wilson Jul 20 '10 at 2:30
Please note, the comments here (regarding Application Proxy and Permissions) worked for me only after I rebooted my machine. – metaomniliquant Mar 6 '12 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).

share|improve this answer

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...

share|improve this answer
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 Jul 19 '10 at 12:41
This guy is having the same trouble:…. What URL does the TaxonomySession's site need to be? Central Admin? – Corbett Jul 19 '10 at 16:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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