sometimes it gets tricky when you want to remove Search Service Application (SP2013) from your farm. Especially, when you have multiple servers that service your search platform.
Before you remove the search services from your farm, I highly recommend you stop all timer jobs and then use STSADM command to remove the search service application. Sometimes, when you request to delete the databases of search as well, it may get a little complicated if the database gets removed but the service application still remains.
First, make sure you are patient enough : don’t try to stop your commands. Sometimes it takes a while to unprovision search. But in case you loose your patience, just do the followings:
Step 1) Stop all active timer jobs, how? easy:
Get-spTimerJob | where { !$_.IsDisabled } | SELECT ID | out-file enabledjobs.txt
Step 2) clean up this text file so there will be only the Guids of the enabled timer jobs.
Step 3) Then disable all timer jobs listed in the .txt file:
Get-Content EnabledJobs.txt | Foreach-Object {Disable-SPTimerJob $_ }
Step 5) Now, simply run this command to get the list of all of the service applications:
Get-SPServiceApplication
Step 6) copy the GUID for the service application and paste it in the following command
stsadm -o deleteconfigurationobject -id <GUID>
Step 7) Then, as soon as you see “Operation completed successfully”, run this command to get the GUID for the search svc proxy:
Get-SPServiceApplicationProxy
Step 8) Copy the guid and use it in the following cmdlet:
Remove-SPServiceApplicationProxy <GUID>
Step 9) now it’s time to enable all the timer jobs you disabled:
Get-Content EnabledJobs.txt | Foreach-Object {Enable-SPTimerJob $_ }
Step 10) Share your experience with others !