Search code examples
powershellsharepointsharepoint-2010

Exporting Managed Properties in SharePoint 2010 via a PowerShell script


I’m running this script I found on technet.

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

Why am I receiving the following error below?

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-S PEnterpris...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:>

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

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


Solution

  • I believe I found the issue. I needed to change the parameter for $SearchServiceApp to "Search Service Application".