
Anyone who’s done a reasonable amount of SharePoint administration will probably have come across services appearing to be stuck on a status Starting/Stopping. There can be many reasons for this, and this article aims to look at how to identify the cause and try to rectify it.
It may sound silly, but often one of the easiest fixes is just to be patient. Some services can take a long time to spin up and change from ‘Starting’ to a status of ‘Started’. For example, on a sizable/complex SharePoint farm, the “Microsoft SharePoint Foundation Web Application” service may take several hours to start up and show the latter status.
If you feel you’ve waited it out (hours or days) or know you are dealing with a service that should start up fairly quickly then you are probably going to need to investigate further. We’re going to be using PowerShell for most of this. Either start with a SharePoint Management Shell (SPMS) session, or remember to load the SharePoint PowerShell library first:
Add-PSSnapIn Microsoft.SharePoint.PowerShell
Code language: plaintext (plaintext)
To investigate our troublesome service(s) we’ll need their information. To do this, run a query that displays information about all services and then find the one(s) you need to debug:
# Queries services on ALL SERVERS
Get-SpServiceInstance | Select Id, Server, TypeName, Status | Format-Table -AutoSize
# Queries a specific server
Get-SpServiceInstance | ? { $_.Server.Address -eq "SERVER-NAME-HERE" } | Select Id, Server, TypeName, Status | Format-Table -AutoSize
Code language: PowerShell (powershell)
The Id column will contain the service GUID, and we can use that to get the extended service details:
# Get the service object
$service = Get-SPServiceInstance -Identity "Service-GUID-Here"
# Displays what $service holds to make sure it is the right service before continuing
$service
Code language: PowerShell (powershell)
Assuming the service details that are displayed are for the service you are debugging, you can now trying re-provisioning (or unprovisioning) the service manually in PowerShell:
# If the service is stuck on stopping, you can try manually unprovisioning it...
$sevice.Unprovision()
# If the service is stuck on starting, you can try manually provisioning it...
$service.Provision()
Code language: PowerShell (powershell)
If the above commands don’t work you can try stopping/starting the services with the dedicated PowerShell commands:
Stop-SPServiceInstance -Identity "Service-GUID-Here"
Start-SPServiceInstance -Identity "Service-GUID-Here"
Code language: PowerShell (powershell)
If any of the commands above fail and quote a timer job ID you can try deleting that timer job and then re-try starting/stopping the service.
$job = Get-SPTimerJob -Identity "Timer-GUID-Here"
$job # Checks the correct timer job has been selected by printing to the console.
$job.Delete() # Deletes the job.
Code language: PowerShell (powershell)
The above should work in 99% of cases. If it still isn’t working then, try leaving it to sort itself out a while longer (as previously advised) as all the changes that have been made may take a little while to process.
This next step isn’t recommended but can sometimes kick a troublesome service back into life… You can access and update the service status directly like this:
# Print the current service status to the console.
$service.Status
# Set the service offline (essentially the same as unprovisioning).
$service.Status = "Offline"
# Disables the service.
$service.Status = "Disabled"
# enables the service (essentially the same as re-enabling but may need to
# manually re-provision afterwards).
$service.Status = "Online"
Code language: PowerShell (powershell)
If we still can’t get the service to complete a starting/stopping activity then other timer jobs that aren’t running may be holding it up. It is worth looking at the job queue to see if there is anything obvious wrong. This article, although the title appears to relate to SharePoint Add-ins, explains in reasonable detail how to view/manage/delete various timer jobs.