2

I have two managed metadata service applications in the Farm. I want to copy all the groups, term sets and terms with existing GUIDs from one MMS term store to another MMS term store using PowerShell. Is it possible?

2 Answers 2

1

Install term set export/import tool WSP from here.

Then use the following PowerShell to export and import Term Groups one by one including all content.

$ver = $host | select version
if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"} 
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

Export-SPTerms -Group (Get-SPTaxonomySession -Site "https://siteconnectedtosourcemms.com").TermStores[0].Groups["TermGroupName"] -OutputFile "c:\temp\terms.xml"

Import-SPTerms -ParentTermStore (Get-SPTaxonomySession -Site "https://siteconnectedtodestinationmms.com").TermStores[0] -InputFile "c:\temp\terms.xml"
6
  • Ok Great! But what will happened if term group with same name already exists in destination MMS. will it be skipped or overwrite or will throw error ?
    – SPBeginer
    Apr 8, 2015 at 9:57
  • If group with same name exists, it will throw error "Import-SPTerms : Failed to read from or write to database. Refresh and try again. If the problem persists, please contact the administrator."
    – Jussi Palo
    Apr 9, 2015 at 5:40
  • After installing WSP, when i run Export-SPTerms and Import-SPTerms commands, it says The term 'Export-SPTerms' is not recognized as the name of a cmdlet? The term ' Import-SPTerms' is not recognized as the name of a cmdlet?
    – SPBeginer
    Apr 9, 2015 at 7:13
  • Did you close and reopen the PowerShell window?
    – Jussi Palo
    Apr 9, 2015 at 7:46
  • Now, i am getting this error: Specified argument was out of the range of valid values. Parameter name: lcid. How i fix this?
    – SPBeginer
    Apr 10, 2015 at 13:48
0

What could be the solution for error you mentioned above

"Failed to read from or write to database. Refresh and try again. If the problem persists, please contact the administrator"

I am using different script but during the test I deleted terms few times and not getting this error. I want to import terms with the same IDs, how can I get rid of these IDs in the database or in other words clean up MMS database ? Any idea ? Thanks in advance. @Jussi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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