Wednesday, November 5, 2014

How to import/export term store in SharePoint 2013


Whenever you are planning to backup/restore site collection, always think about exporting and importing term store. 

You need to use the following scripts to perform these operations: 

Export:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#problem: The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.
#solution: you may need to open powershell as administrator
$mmsApp= Get-SPServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
#$mmsApp = Get-SPServiceApplication
echo $mmsApp.Id
#$mmsApp = #Copy the Id for managed meta data service and place.

$mmsproxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata Service Connection"};
#$mmsproxy = Get-SPServiceApplicationProxy
echo $mmsproxy.Id
#$mmsproxy = #Copy the Id for managed meta data service app proxy and place.

Export-SPMetadataWebServicePartitionData -Identity $mmsApp.Id.ToString() -ServiceProxy $mmsproxy.Id.ToString() -Path "\\server\termstore.bak"


Import:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#problem: The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.
#solution: you may need to open powershell as administrator
$mmsApp= Get-SPServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}
#$mmsApp = Get-SPServiceApplication
echo $mmsApp.Id
#$mmsApp = #Copy the Id for managed meta data service and place.

$mmsproxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata Service Connection"};
#$mmsproxy = Get-SPServiceApplicationProxy
echo $mmsproxy.Id
#$mmsproxy = #Copy the Id for managed meta data service app proxy and place.

Import-SPMetadataWebServicePartitionData -Identity $mmsApp.Id.ToString() -ServiceProxy $mmsproxy.Id.ToString() -Path "\\server\termstore.bak" -OverwriteExisting




No comments:

Post a Comment