I have a corrupted Search service in SharePoint 2013. I'm trying to delete it using PowerShell.
$P = Get-SPServiceApplication -identity "myGuid" Remove-SPServiceApplication $P -RemoveData -confirm:$false
The problem is that the delete process takes a very long time. I waited for a whole day and yet the command has still not finished. However, I foundthat the following databases get deleted:
But the Search Service Application still exist in CA and the app pool for Search Service still remain.
How I can delete a corrupted Search Service Application?
What I have tried so far:
- Stop search service, timer job and clear the configuration cache.
- Reboot the machine.
$spapp = Get-SPServiceApplication -Name "Search Service Application"
When I ran the above cmd I get the following error:
format-default : Exception has been thrown by the target of an invocation. + CategoryInfo : NotSpecified: (:) [format-default], TargetInvocationException + FullyQualifiedErrorId : System.Reflection.TargetInvocationException,Microsoft.PowerShell.Commands.FormatDefaultCommand
The logs said that it could not connect to the databases which was already deleted.