how could i create terms inside existing group/termset

$TaxonomySession = Get-SPTaxonomySession -site $TaxonomySite
$termStore=$TaxonomySession.TermStores["Managed MetaDataService"]

foreach($termSet in $Content.Settings.Terms.Term)


I get this error

Cannot index into a null Array groups["Users"] termsets["Department] CreateTerm: The term CreateTerm is not recognized as the name of a cmdlet

3 Answers 3


You can create term to a particular term set using

$termGroup = $termStore.Groups["GroupName"] 
$termSet = $termGroup.TermSets["TermSetName"]

$term = $termSet.CreateTerm("new term name") 

Please refer the below PowerShell function using Client Object to create a new term in a Term Set. This can can be executed from remote machine you need not to be on server.

You need to set few parameters and pass it to function.

Parameter explanation:

$MMSbaseurl - Its the URL to website on which you have termsets and groups for e.g. http://yoursite

$credentials - Your credentials to the site, you need to have enough permissions to access and edit meta data

$GroupName - Name of the group in Term Set lives

$TermSetName - Name of the term set in which you want to create a new term

$lcid - locale ID you are using

    function Create-NewTerm() {



    Write-Host "Preparing for term store...." -ForegroundColor Cyan
        $Context = New-Object Microsoft.SharePoint.Client.ClientContext($MMSbaseurl)
    catch {
        Write-Host "Error:-->> Unable to create ClientContext at " $MMSbaseurl -ForegroundColor Red

        Write-Host "Binding to Term store through managed metadata services for ($MMSbaseurl) " -ForegroundColor Cyan
        $Context.Credentials = $credentials
        $MMS = [Microsoft.SharePoint.Client.Taxonomy.TaxonomySession]::GetTaxonomySession($Context)

        Write-Host "Retrieving Term Stores" -ForegroundColor Cyan
        $TermStores = $MMS.TermStores

        Write-Host "Binding term store" -ForegroundColor Cyan
        $TermStore = $TermStores[0]

        Write-Host "Binding term store Groups" -ForegroundColor Cyan
        $Groups = $TermStore.Groups

        foreach($Group in $Groups) {
            if ((($Group.Name.ToLower()) -eq $GroupName.ToLower()))
                $SelectedGroup = $Group
                Write-Host "Group found." -ForegroundColor Cyan


        Write-Host "Bind to term set" -ForegroundColor Cyan
        $TermSets = $SelectedGroup.TermSets

        foreach($TermSet in $TermSets) {
            if ((($TermSet.Name.ToLower()) -eq $TermSetName.ToLower()))
                $SelectedTermSet = $TermSet
                Write-Host "Term set found." -ForegroundColor Cyan


        #Term creation
        $NewTerm = $TermSet.CreateTerm("New Term", $lcid, [System.Guid]::NewGuid().toString())
        Write-Host "New term created successfully" -ForegroundColor Cyan

        Write-Host "Error -->>>> " $_.Exception.Message -ForegroundColor Red


#Get and Set credentials
$credentials = Get-Credential

#Call Function
Create-NewTerm "http:YourSite.com" $credentials "New Group" "New Term Set" 1033

Same function you can refer at this blog


try this code,

#Connect to Central Admin 
$taxonomySite = get-SPSite http://centraladminsite:port

#Connect to Term Store in the Managed Metadata Service Application 
$taxonomySession = Get-SPTaxonomySession -site $taxonomySite 
$termStore = $taxonomySession.TermStores["Managed Metadata Service"] 
write-host "Connection made with term store -"$termStore.Name

#Connect to the Group and Term Set 
$termStoreGroup = $termStore.Groups["Group Name"] 
$termSet = $termStoreGroup.TermSets["Term Set Name"]

#Create term, term description, and a synonym 
$term = $termSet.CreateTerm("Test Term", 1033) 
$term.SetDescription("This is a test", 1033) 
$term.CreateLabel("This is a test synonym", 1033, $false)

#Update the Term Store 

Source: Create a new term in Existing Group and Term Set Under Managed Metadata Service Application with PowerShell

  • You cannot call a method on a null-valued expression on "Test Term" and "This is test" and "This is a test synonym"
    – Batistuta
    Commented May 4, 2015 at 5:44

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.