Importing Query Scopes and Metadata Managed Properties in Windows PowerShell

Mar 9, 2010 at 8:04 AM


I am currently working on importing query scopes and metadata managed properties from a SharePoint Search Service Application of one server to another. I used the Export-CliXML and ConvertTo-HTML to export the query scopes and metadata managed properties. The query scopes and metadata managed properties are exported in an XML file (Export-CliXML) while using the ConvertTo-HTML file converts the objects into an XML object and saves it in a file.

I am having an issue with importing the query scopes and metadata managed properties to the destination server. The XML object was converted back to a Windows PowerShell object using Import-CliXML. I am trying the approach of piping in the resulting object to the New-Object of type Microsoft.Office.Server.Search.Administration.Scope type. However, the approach did not work.  I get the following error message

New-Object : Constructor not found. Cannot find an appropriate constructor for type Microsoft.Office.Server.Search.Administration.Scope
At line:1 char:21
+ $newscope=New-Object <<<<  Microsoft.Office.Server.Search.Administration.Scope
    + CategoryInfo          : ObjectNotFound: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand

I am creating a PS script where I can export the objects from one server and imports the objects into another server. I tried to work on this since I have a lot of scopes and managed properties.

Is this possible? Do you have any suggestions on how I can work easily on importing objects?