Import / Export Managed Metadata Service Application

Import Managed Metadata Service Application

=================================================================================

Add-PsSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
$mmsApplication = Get-SPServiceApplication | ?{$_.TypeName -eq "Managed Metadata Service"}
$mmsProxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata ServiceConnection"}
if ((read-host "WARNING: Running this script will overwrite all existing Terms in the chosen Managed Metadata Service, type Y to confirm otherwise press any key") -eq "Y") {
   Import-SPMetadataWebServicePartitionData -Identity $mmsApplication.Id -ServiceProxy $mmsProxy -Path "\\sysldns012\sharepoint\backups\15-07-2014\MMS_15-07-2014.cab" -OverwriteExisting;  #Enter valid location to export to
}​

==============================================================

Export Managed Metadata Service application


Add-PsSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
$today = (Get-Date -Format dd-MM-yyyy)
$workingDirectory = "C:\Backups\$today"
write-host "Creating working directory at $workingDirectory"
[IO.Directory]::CreateDirectory($workingDirectory)

$mmsBackupPath = "$workingDirectory\MMS_$today.cab"
write-host "Exporting MMS to $mmsBackupPath"
$mmsApplication = Get-SPServiceApplication | ?{$_.TypeName -eq "Managed Metadata Service"}
$mmsProxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Managed Metadata Service Connection"}
Export-SPMetadataWebServicePartitionData -Identity $mmsApplication.Id -Path $mmsBackupPath -ServiceProxy $mmsProxy​

Comments

Popular posts from this blog

How to Improve Workflow Performance in SharePoint Server 2010

PowerShell Script to Check and Generate Report on Access Rights for a Specific User:

Disable Loopbackcheck using PowerShell