Export/Import Managed Properties via Powershell

Today I published a new Powershell script on Technet Gallery that allows SharePoint Administrators to update the search schema exporting, importing and deleting managed properties, crawled properties mapping included.

Should I make my blog “global” or keep it “local”? This is something I’ve been wondering about for a long time. Now it’s time to cross the line and so here we are: this is my first “non-Italian” post (I don’t pretend to call it “English” yet).

Today I published a new Powershell script on Technet Gallery (http://gallery.technet.microsoft.com/Powershell-script-to-09ffa974) that allows you to update the SharePoint 2013 search schema exporting, importing and deleting managed properties.

The idea behind this script is to let you “move” Managed Properties across farms without recreating them manually and simplify this task. It can also be useful to track the changes made to the search schema.

When I create managed properties I usually add a description that helps me identifying the scope of the property or, if possible, I add a prefix to each managed property name. Starting from this scenario I created the following script that allows to export a subset of managed properties (or the whole list, but be careful! Even if you can, it doesn’t always mean you should). In both cases you’ll get metadata mapping too.

Once you got the export file (a CSV document called export-managed-properties.csv) you’ll be able to import it into a new farm (or keep it as a backup, if it makes any sense).

With this script you will also be able to delete a subset of managed properties. This action will remove all the crawled properties mapping first and then try to delete the managed property.

Usage and Examples

The script has three switches: -Export, -Import and -Delete. All of them require the parameter ServiceApp where you have to specify the name of your search service application.

When you use the Export switch you can optionally set the filter parameter. If you set it the script will select only the managed property that begins with the string specified as parameter value. As I already said this parameter is optional. It does not mean you should not set it, I suggest  setting it in the 99% of the cases.

The import switch has no additional parameters, you only have to make sure that the export file is in the same directory where you execute the script (not necessarily where you save the script file).

The filter parameter is required when you use the delete switch and it works exactly the same as described above.

ps. In all of these examples “Enterprise Search” is the name of my SSA and AF is a sample filter text.


Posted by Riccardo

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.