Skip to content
Rishan Solutions
Rishan Solutions
  • PowerApps
  • SharePoint online
    • Uncategorized
    • Uncategorized
  • PowerAutomate
Rishan Solutions
Latest Posts
  • Agentic AI: The Dawn of Autonomous Intelligence Revolutionizing 2025 June 24, 2025
  • Recursive Queries in T-SQL May 7, 2025
  • Generating Test Data with CROSS JOIN May 7, 2025
  • Working with Hierarchical Data May 7, 2025
  • Using TRY_CAST vs CAST May 7, 2025
  • Dynamic SQL Execution with sp_executesql May 7, 2025

Automating SharePoint Term Store Management using PnP PowerShell

Posted on March 19, 2025March 19, 2025 by Rishan Solutions

Loading

Managing SharePoint Term Store efficiently is crucial for maintaining metadata consistency across sites. PnP PowerShell simplifies the automation of Term Store operations, enabling users to create, update, delete, and export terms effortlessly.

This guide provides a step-by-step approach to automate SharePoint Term Store Management using PnP PowerShell.


Prerequisites

Before executing the script, ensure:

PnP PowerShell Installed
Install it using:

Install-Module -Name PnP.PowerShell -Force -AllowClobber

Admin Permissions in SharePoint Online

  • You must be a SharePoint Term Store Administrator.

Connection to SharePoint Online

Connect-PnPOnline -Url "https://yourtenant-admin.sharepoint.com" -Interactive

Step 1: Retrieve Term Store Information

To check existing Term Groups, Term Sets, and Terms, use:

# Get all Term Groups
Get-PnPTermGroup

# Get Term Sets under a specific Term Group
Get-PnPTermSet -TermGroup "Company Announcements Tags"

# Get Terms inside a Term Set
Get-PnPTerm -TermSet "Categories" -TermGroup "Company Announcements Tags"

🔹 This helps validate existing metadata structure before making changes.


Step 2: Create a New Term Group

A Term Group organizes related Term Sets.

New-PnPTermGroup -Name "HR Taxonomy" -Description "HR-related metadata"

Creates a new Term Group named HR Taxonomy.


Step 3: Create a Term Set

A Term Set contains structured metadata terms.

New-PnPTermSet -Name "Job Roles" -TermGroup "HR Taxonomy" -Lcid 1033

Creates a Job Roles Term Set inside HR Taxonomy.
LCID 1033 represents English (US).


Step 4: Add Terms to a Term Set

Now, populate the Job Roles Term Set with terms.

New-PnPTerm -TermSet "Job Roles" -TermGroup "HR Taxonomy" -Name "Software Engineer" -Lcid 1033
New-PnPTerm -TermSet "Job Roles" -TermGroup "HR Taxonomy" -Name "Data Analyst" -Lcid 1033
New-PnPTerm -TermSet "Job Roles" -TermGroup "HR Taxonomy" -Name "Cybersecurity Specialist" -Lcid 1033

Adds three job roles under Job Roles Term Set.


Step 5: Update an Existing Term

To rename or update a term:

Set-PnPTerm -Identity "Cybersecurity Specialist" -TermSet "Job Roles" -TermGroup "HR Taxonomy" -NewName "SOC Analyst"

Renames Cybersecurity Specialist to SOC Analyst.


Step 6: Delete a Term, Term Set, or Term Group

To delete a Term:

Remove-PnPTerm -Identity "Data Analyst" -TermSet "Job Roles" -TermGroup "HR Taxonomy" -Confirm:$false

To delete an entire Term Set:

Remove-PnPTermSet -Identity "Job Roles" -TermGroup "HR Taxonomy" -Confirm:$false

To delete a Term Group:

Remove-PnPTermGroup -Identity "HR Taxonomy" -Confirm:$false

Warning: Deleting a Term Group removes all associated Term Sets and Terms.


Step 7: Export Term Store to CSV

To export all terms for backup:

$terms = Get-PnPTermGroup | ForEach-Object {
Get-PnPTermSet -TermGroup $_.Name | ForEach-Object {
Get-PnPTerm -TermSet $_.Name -TermGroup $_.Group
}
}

$terms | Select Group, TermSet, Name | Export-Csv -Path "C:\SharePoint_Terms.csv" -NoTypeInformation

Creates a CSV backup of all Term Groups, Term Sets, and Terms.


Step 8: Import Terms from CSV (Bulk Creation)

Prepare a CSV file with the format:

TermGroupTermSetTermName
HR TaxonomyJob RolesFrontend Developer
HR TaxonomyJob RolesBackend Developer
HR TaxonomyJob RolesCloud Engineer

Run the following script to import terms from CSV:

$csvData = Import-Csv -Path "C:\SharePoint_Terms.csv"

foreach ($row in $csvData) {
New-PnPTerm -TermSet $row.TermSet -TermGroup $row.TermGroup -Name $row.TermName -Lcid 1033
}

Creates multiple terms in bulk from the CSV file.


Step 9: Schedule the Script for Automation

1️⃣ Open Task Scheduler
2️⃣ Click Create Basic Task
3️⃣ Set Trigger: Daily/Weekly
4️⃣ Set Action: Start a Program
5️⃣ In Program/script, enter:

-ExecutionPolicy Bypass -File "C:\YourScriptPath\ManageTermStore.ps1"

6️⃣ Click Finish

Now, Term Store operations run automatically on schedule.


Troubleshooting Common Issues

Issue 1: PnP PowerShell Not Recognized

Run:

Update-Module -Name PnP.PowerShell

Issue 2: Connection Errors

Ensure you are connecting with Admin Privileges:

Connect-PnPOnline -Url "https://yourtenant-admin.sharepoint.com" -Interactive

Issue 3: Terms Not Updating

  • Verify that the Term Group and Term Set names match.
  • Check if the Term Set is not locked in SharePoint.
Posted Under PNP PowerShellaudit logs Bulk Import Cloud Automation cloud computing Compliance data governance Data Management Digital Transformation Enterprise Content Management Enterprise Metadata Information Architecture IT Automation IT security Metadata Management Microsoft 365 Microsoft SharePoint Office 365 PNP PowerShell PowerShell scripting SharePoint SharePoint Admin SharePoint Automation SharePoint Best Practices SharePoint Compliance SharePoint Customization SharePoint Governance SharePoint management SharePoint Metadata SharePoint online SharePoint Online Reports SharePoint optimization SharePoint Taxonomy Taxonomy Management Term Groups Term Sets Term Store

Post navigation

IoT and AI-Powered Home Assistants
IoT-Based Water Leak Detection Systems

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Agentic AI: The Dawn of Autonomous Intelligence Revolutionizing 2025
  • Recursive Queries in T-SQL
  • Generating Test Data with CROSS JOIN
  • Working with Hierarchical Data
  • Using TRY_CAST vs CAST

Recent Comments

  1. Michael Francis on Search , Filter and Lookup in power apps
  2. A WordPress Commenter on Hello world!

Archives

  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • March 2024
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • June 2023
  • May 2023
  • April 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • January 2022

Categories

  • Active Directory
  • AI
  • AngularJS
  • Blockchain
  • Button
  • Buttons
  • Choice Column
  • Cloud
  • Cloud Computing
  • Data Science
  • Distribution List
  • DotNet
  • Dynamics365
  • Excel Desktop
  • Extended Reality (XR) – AR, VR, MR
  • Gallery
  • Icons
  • IoT
  • Java
  • Java Script
  • jQuery
  • Microsoft Teams
  • ML
  • MS Excel
  • MS Office 365
  • MS Word
  • Office 365
  • Outlook
  • PDF File
  • PNP PowerShell
  • Power BI
  • Power Pages
  • Power Platform
  • Power Virtual Agent
  • PowerApps
  • PowerAutomate
  • PowerPoint Desktop
  • PVA
  • Python
  • Quantum Computing
  • Radio button
  • ReactJS
  • Security Groups
  • SharePoint Document library
  • SharePoint online
  • SharePoint onpremise
  • SQL
  • SQL Server
  • Template
  • Uncategorized
  • Variable
  • Visio
  • Visual Studio code
  • Windows
© Rishan Solutions 2025 | Designed by PixaHive.com.
  • Rishan Solutions