Tuesday, August 20, 2013

Unprovision duplicate service instances in SharePoint 2013

Recently when I checked one of our SharePoint farms (3 server farm with one WFE server, one Application server and one database server), I noticed that service application instances are not provisioned as we planned.
For an example the “SharePoint Server Search” service instance was running on both WFE and Application servers which should be enabled only in the Application server.
So how can we stop that service instance in the WFE server ? can we do it from the central administration itself ?
Unfortunately we can’t. If we try that way we get the following error

image
Instead of using the central administration, we can use PowerShell. We need to get the correct guid of the service application instance.(in this case we need to unprovision the search service instance of WFE server) . As I explained in this post we can get the id of relevant service application instance
   1: Get-SPServiceInstance | where {$_.Status -eq "online" -and $_.TypeName -eq "SharePoint Server Search" } | Sort TypeName | Format-Table TypeName,Id,Server
I got two results for above query as below.

image
To unprovision the SharePoint server search instance from WFE server, I execute the following command
   1: $sh = Get-SPServiceInstance -Identity "7fbdf7a3-c471-4cd7-ba26-4432236b3bd7"
   2: $sh.Unprovision()
That will disable the Search service instance from WFE server.

2 comments:

swapnil kamle said...

I am facing the following issue when trying to Unprovision search service on WFE
Exception calling "Unprovision" with "0" argument(s): "Invalid search service unprovisioning: application 'Search Service Application' still has a ready component 'in
search service instance' on server ."
At line:2 char:1
+ $sh.Unprovision()
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException

swapnil kamle said...

Exception calling "Unprovision" with "0" argument(s): "Invalid search service unprovisioning: application 'Search Service Application' still has a ready component 'in
search service instance' on server 'INFO-INFOPPMS'."
At line:2 char:1
+ $sh.Unprovision()
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException