Good day,
I'm trying to run the following code. All steps succeed when I execute them individually until I get to '$searchapp = Get-SPEnterpriseSearchServiceApplication -Identity "Search Service Application"'. I've checked the name of the service application and this line works just fine when I run it locally on the server.
Enable-PSRemoting -force $remoteSession = New-PSSession -ComputerName "myServer" Enter-PSSession $remoteSession if ( (Get-PSSnapin -Name Microsoft.Sharepoint.Powershell -ErrorAction SilentlyContinue) -eq $null ) { Add-PsSnapin Microsoft.Sharepoint.Powershell } $searchapp = Get-SPEnterpriseSearchServiceApplication -Identity "Search Service Application" $contentsources = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp | ForEach-Object{$_.StartFullCrawl()} Exit-PSSession Remove-PSSession $remoteSession
The following is the exception thrown:
Get-SPEnterpriseSearchServiceApplication : The type initializer for 'Microsoft.
Office.Server.Search.LocStringIdLookupTable' threw an exception.
At line:1 char:54
+ $searchapp = Get-SPEnterpriseSearchServiceApplication <<<< -Identity "Search
Service Application"
+ CategoryInfo : InvalidData: (Microsoft.Offic...viceApplication:
GetSearchServiceApplication) [Get-SPEnterpriseSearchServiceApplication], T
ypeInitializationException
+ FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.GetSearchS
erviceApplication