I accidentally created 9 of a termset and now am experiencing issues. I really don't want to delete the whole site collection they exist in but must do something. I created them through powershell and they don't show up after a crawl. This is 2013 in the product catalog site template, the authoring one.

Using powershell I got the actual GUID of one of them and can't delete it, there were 9 to start and 9 after calling delete() on one

PS C:\Users\EllisMi\Documents> $termStore.GetTermSet('a1e752b2-db42-44bb-929d-5f998d4adce4').Delete()
PS C:\Users\EllisMi\Documents> $termStore.GetTermSets("Product Hierarchy", 1033).Count

What can I do? Also why are they invisible in the term store manager on my site collection? I am very new and using 2013


You need to call $termStore.CommitAll() after calling delete in order to actually delete the termset. Then again retrieve the termstore object to see the correct count of termsets as termstore uses a cache internally.

The local termgroups are linked to the Site collection in a 2-way manner i.e. the termgroup has the SiteCollectionID set in its properties AND the root web has web property bag containing the termgroup ID. If this link is broken for ex., when you do backup/restore, then you have manually set these properties to make it appear in UI. Note that a backup/restore of the site collection causes a new ID to be assigned to the site collection. Here is a link that explains this in detail along the scripts: https://blogs.msdn.microsoft.com/bettertogether/2014/10/04/site-collection-backuprestore-when-using-local-term-groups/.

Although the above blog post is for 2010, works the same way even in 2013.


I found a site detailing exactly what needed to be done http://thesharepointbar.com/?p=432

Basically access the appropriate term store, then access the groups that need to be deleted or have termsets deleted from them.

Then you just call delete on them, and this short article I linked above will provide a foreach loop that deletes all of the termsets and the group itself. Simply alter it to meet any needed purpose. I added an array @(group1, group1..) and just deleted the groups I needed deleted and remade them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.