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
$session = Get-SPTaxonomySession -Site $sitename
$termStore = $session.TermStores[“Managed Metadata Application”]
$group = $termstore.CreateGroup(“My New Group”)
$group.Description = "My Term Group"
$termSet = $group.CreateTermSet(“My TermSet”,1033)
$termSet.Description = “My TermSet”
$termSet.IsAvailableForTagging = $true
$termSet.IsOpenForTermCreation = $true

Here like $termSet.IsAvailableForTagging I want to enable "Use this Term Set for Site Navigation" using powershell.

Thanks in advance

share|improve this question
up vote 2 down vote accepted

Finally I achieved it with following code.

 $navigationSet = $group.CreateTermSet($termsetName)
 $navigationSet.SetCustomProperty("_Sys_Nav_IsNavigationTermSet", "True")
 $navigationSet.SetCustomProperty("_Sys_Nav_AttachedWeb_SiteId", $site.ID.ToString())
 $navigationSet.SetCustomProperty("_Sys_Nav_AttachedWeb_WebId", $site.RootWeb.ID.ToString())    
 $navigationSet.SetCustomProperty("_Sys_Nav_AttachedWeb_OriginalUrl", $site.RootWeb.Url )
share|improve this answer

You do this in powershell by converting the TermSet to a NavigationTermSet

$site = Get-SPSite -Identity $sitename 
$navTermSet = [Microsoft.SharePoint.Publishing.Navigation.NavigationTermSet]::GetAsResolvedByWeb($termSet, $site.RootWeb, "GlobalNavigationTaxonomyProvider");

Now you have access to the navigation term set object in powershell and can use it like in oldbam's answer

share|improve this answer
Not interested in OP's question at all but man I've been looking for these two lines of code all over the place. Thank you so much. Do you have sites giving more details about taxonomy in powershell? +1 – Ergec Nov 26 '14 at 7:41
@Ergec I am a developer so I often transpose C# into powershell to quickly test things out. That being said here are some sites that I trust that often have SharePoint and Powershell posts; Karine Bosch, Todd Klindt, Wictor Wilen, Spencer Harbar, and Andrew Connell. Hope you find those useful. – mark Nov 26 '14 at 17:58

This code should help you:

     // Obtain navigation term set
     NavigationTermSet navigationTermSet = NavigationTermSet.GetAsResolvedByWeb(termSet, web, "GlobalNavigationTaxonomyProvider");
     // Specify that this term set can be used for site navigation
     navigationTermSet.IsNavigationTermSet = true;
     // specify target page for all terms in this term set 
     navigationTermSet.TargetUrlForChildTerms.Value = "~site/Pages/Topics/Topic.aspx";
share|improve this answer
How to obtain the same in powershell? – Anuja Feb 5 '13 at 6:47

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.