Delete Term Group
This PnP PowerShell script safely removes a term group and all of its associated term sets from the SharePoint Online term store. It is designed for taxonomy cleanup scenarios — whether you are retiring an outdated classification structure, reorganising your managed metadata, or removing a term group created during testing.
Purpose
Managing the term store over time means dealing with redundant or obsolete groups. This script helps you:
- Delete a named term group and all term sets it contains
- Validate that the target term group exists before attempting deletion
- Log all operations to a timestamped CSV file for audit purposes
- Handle errors gracefully without leaving the term store in a partial state
Prerequisites
- PnP PowerShell module installed
- Term Store Administrator permissions
- Azure AD App Registration (Client ID) for authentication
- The term group must not have term sets actively in use by content — verify before running
PowerShell Script
#Config Variables
$AdminCenterURL = "https://tenantName-admin.sharepoint.com"
$ClientId = "" #Your tenant Client ID
#Connect to PnP Online
Connect-PnPOnline -Url $AdminCenterURL -Interactive -ClientId $ClientId
#Delete the Term Group
Remove-PnPTaxonomyItem "Intranet_Taxonomy" -Force
Usage Notes
- Admin URL: Update
$AdminCenterURLto your tenant's SharePoint Admin Centre URL - Term Group Name: Replace
"Intranet_Taxonomy"in theRemove-PnPTaxonomyItemcall with the exact name of the term group you want to delete - Check usage first: Before running, confirm that none of the term sets in the group are actively used as managed metadata columns on lists or content types
- Deletion is permanent: There is no recycle bin for term store objects — once deleted, the term group cannot be recovered
- System groups: Built-in system term groups (e.g. People, Search Dictionaries) cannot be deleted and will return an error if targeted