Create A Taxonomy Group In SharePoint 2013 Using PowerShell

Steps
  1. Open your SharePoint Management Shell.
  2. Copy the code given below and paste it there.
  3. Run the code given below to delete the SharePoint search component.
Code
  1. $taxonomySession=Get-SPTaxonomySession -Site "https://gowtham.sharepoint.com/tutorials"  
  2. $termStore=$taxonomySession.TermStores["MMS"]  
  3. $group=$termStore.CreateGroup("MMSGroup")  
  4. $termStore.CommitAll()  
Another Reusable code
  1. function DeleteTermGroup  
  2. {  
  3. param([string]$site,[string]$termstoreName,[string]$groupName)  
  4.   
  5.       
  6.     $session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)  
  7.     $termstore = $session.TermStores[$termstoreName]  
  8.     $group=$termStore.CreateGroup($groupName)      
  9.     $termstore.CommitAll()  
  10.       
  11.     Write-Output "Create $groupName"  
Delete Term Group 
  1. function DeleteTermGroup  
  2. {param([string]$centralAdmin,[string]$termstoreName,[string]$groupName)  
  3.   
  4.     $site = Get-SPSite $centralAdmin  
  5.     $session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)  
  6.     $termstore = $session.TermStores[$termstoreName]  
  7.     $group=$termStore.Groups[$groupName]  
  8.     $group.TermSets|foreach{  
  9.         $_.Delete()  
  10.         $termstore.CommitAll()  
  11.     }  
  12.     $group.Delete()  
  13.     $termstore.CommitAll()  
  14.   
  15.     Write-Output "Deleted $groupName"  
  16.   
  17. }  
Thanks for reading my blog. 
Ebook Download
View all
Learn
View all