If you like my video or the blog please subscribe to my YouTube channel to get me going https://www.youtube.com/channel/UC6vLzWN-3aFG8dgTgEOlx5g
In this blog I will talk about a simple PnP PowerShell script which adds Child Terms under each term following the same hierarchy in SharePoint Taxonomy / Metadata.
Note that the same script can be used in SharePoint Online, 2013, 2016 or 2019.
You can refer to below hierarchical structure:
Term Group (Region names) –> Term Set (Region) –> Countries –> Customer –>Mine

In this example I want to add a new term called “Mine missing” under each customer, so instead of doing it manually I will use a script to add Mine missing under each Customer for each country.
Connect-PnPOnline -url <<site url >> #Here I have used term guid for Asia Pacific to point to a Term $ParentTerm = Get-PnPTerm -Identity <<term guid>> -TermSet "Regions" -TermGroup "Region names" -IncludeChildTerms -Recursive $countryterm = $ParentTerm.Terms foreach($term in $countryterm) { $addterms = $term.Terms foreach($addedterm in $addterms) { $ChildTerm = $addedterm.CreateTerm("Mine Missing", 1033, (New-Guid)) Invoke-PnPQuery } }
Connect with me on Twitter or Linked In and follow YouTube Channel or my blog https://twitter.com/SinhaKislay