0

I’m running this script I found on technet.
Why am I receiving the following error below?

Export Managed/Crawled Properties from Enterprise Search https://gallery.technet.microsoft.com/office/Export-ManagedCrawled-7548d31b

PS C:\> .\Export-SpSearchManagedProperties.ps1
Get-SPEnterpriseSearchMetadataManagedProperty : SearchApplication Search Service not found.
At C:\Staging\Export-SpSearchManagedProperties.ps1:14 char:67
+ $ManagedPropreties = Get-SPEnterpriseSearchMetadataManagedProperty <<<<  -SearchApplication $SearchServiceApp
+ CategoryInfo          : InvalidData: (Microsoft.Offic...ManagedProperty:GetSearchMetadataManagedProperty) [Get-SPEnterpris...ManagedProperty], KeyNotFoundException
+ FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.GetSearchMetadataManagedProperty

You cannot call a method on a null-valued expression.

At C:\Staging\Export-SpSearchManagedProperties.ps1:28 char:32
+     $Mappings = $MP.GetMappings <<<< ()
    + CategoryInfo          : InvalidOperation: (GetMappings:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Staging\Export-SpSearchManagedProperties.ps1:33 char:29
+             if ($CP.Contains <<<< (":") -eq $true){
+ CategoryInfo          : InvalidOperation: (Contains:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

PS C:\>

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

My Environment – Windows Server 2008 R2 Datacenter 64-bit

$PSVersionTable Name Value PSVersion 2.0

$host Name : ConsoleHost Version : 2.0 UI : System.Management.Automation.Internal.Host.InternalHostUserInterface

Get-SPEnterpriseSearchServiceInstance -local TypeName : SharePoint Server Search Description : Index content and serve search queries Role : None Status : Online

1

The script is expecting the name of your Search Service Application and a filename as parameter.

Correct way of calling this script is

.\Export-SpSearchManagedProperties.ps1 "Search Service Application" c:\outputfile.xml

Replace Search Service Application with the name of your Search Service Application. This can be found in Central Admin > Service Applications.

  • I needed to change the parameter for $SearchServiceApp to "Search Service Application". – user5305155 Oct 21 '15 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.