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
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"
-
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 ? 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." 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? Apr 9, 2015 at 7:13
-
-
Now, i am getting this error: Specified argument was out of the range of valid values. Parameter name: lcid. How i fix this? Apr 10, 2015 at 13:48
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