Friday, January 27, 2012

Stop-SPServiceInstance - Using PowerShell to find and stop services

When a service is stuck in the starting status in Central Admin, how can you stop the service?  SharePoint Powershell of course.
First, you need to find the GUID of the service.  
Run Get-SPServiceInstance on the server with the issue.  If the name of the service is long, it will probably be cut off.  To see the full name, use powershell formatting and change the window size of the powershell prompt.  
Go to Properties > layout and change the width for buffer and window size to 120+.  
Next, enter the same command as above with the format-table -autosize option
Get-SPServiceInstance | format-table -autosize 
Second, use the GUID (ID) from the command above for the stuck service and run 
Stop-SPServiceInstance {GUID}
Wait a moment and run the first command again to verify the service has successfully stopped. 

No comments:

Post a Comment