Friday, February 27, 2015

SharePoint: User Profile Synchronization Service stuck on starting


You check the Manage Profile Service page of your User Profile Service Application and note that the Profile Synchronization Status seems to be stuck on starting.  You remove the connection that was used by the Profile Synchronization service that is now trying to start, but this doesn't change the status.  You even try removing the User Profile Service application, but find that the User Profile Synchronization Service remains stuck on Starting.

  1. Using the SharePoint Setup User Administrator account, log into the SharePoint server on which the User Profile Service application is running.
  2. Open an elevated SharePoint Management Shell.
  3. Execute Get-SPServiceInstance:
    This returns a listing of service instances on all SharePoint servers.  You can clean up the output by using: Get-SPServiceInstance | Where-Object {$_.Server -Like "*yourserver*"} | Select-Object TypeName, ID, status | Sort-Object TypeName
  4. Search through the listing returned by this command for User Profile Synchronization Service, and then note the  Id for this service (not the UserProfileApplicationGuid).
  5. Execute Stop-SPServiceInstance -Identity <theID>
  6. In Central Administration, navigate to Manage Services on Server. The service status should now be Stopping.
  7. Open the server Services applet.
  8. Restart the SharePoint Timer Service.
  9. Check Manage Services on Server again: after a few seconds, the status should change to Stopped.
    While this stops the service, it does not stop the associated user profile import timer job, User Profile Service_ProfileSynchronizationJob, from still being run and generating a critical application error event 6398 every time.  To stop this job, you can either remove the User Profile Service application or disable the job itself.  To remove the UPA, use Central Administration's Manage Service Applications page.  To disable the timer job, continue to the next step.
  10. Execute Get-SPTimerJob | Where-Object {$_.Schedule -Like "*1 minute*"} | Sort-Object Name | Select-Object name, ID, Status.
  11. Look for User Profile Service_ProfileSynchronizationJob, and then copy its ID.
  12. Execute Get-SPTimerJob -Identity <jobID> | Disable-SPTimerJob.
  • Stopping the service does not necessarily affect the import timer job.
  • Update 03/02/16: I attempted to uninstall the User Profile Service Application from Central Administration by deleting the service application.  This failed, and I then experienced the UPA being stuck on stopping.  SharePoint Services on Server indicated that UPA was Stopping.  Same in SharePoint Service Applications.  Executing Stop-SPServiceInstance on the UPA service, the following error was presented:
    Stop-SPServiceInstance : An object of the type Microsoft.SharePoint.Administration.SPServiceInstanceJobDefinition named
    "job-service-instance-5253819b-2e5b-49fe-b854-5970b970e97b" already exists under the parent
    Microsoft.SharePoint.Administration.SPTimerService named "SPTimerV4".  Rename your object or delete the existing object.
    At line:1 char:1
    I was able to resolve this by launching an elevated command shell and executing this stsadm command:
    stsadm -o provisionservice  -action stop -servicetype "Microsoft.Office.Server.Administration.ProfileSynchronizationService, Microsoft.Office.Server.UserProfiles, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" -servicename FIMSynchronizationService
    as per this posting.  When I then executed Get-SPTimerJob... it showed that the UPA service having a status of Disabled.  When I checked the Sharepoint Services on Server status of UPA, it showed a status of Stopping.  I then again attempted to delete the service application from Central Administration Service Applications, this time it completed successfully.
  • Synchronization Service Manager: tool useful for troubleshooting the SharePoint User Profile Service Application.  You'll find it at this folder location:
    \Program Files\Microsoft Office Servers\15.0\Synchronization Service\UIShell
    Look for miisclient.exe.  It enables you to view the real-time status of UPA processes, among many other things.  I don't use it to manage FIM; just to view status information.  For example, I have used to troubleshoot a UPA that failed to start.  As I tried different troubleshooting steps, I monitored Synchronization Service Manager, watching in real-time to see how far UPA started, before stopping.  It also provides helpful other information, such as confirmation of the Domain Controller that it is connecting to.  If you configured UPA using Auto Detect for DC, you can now determine exactly which DC it is connecting to.  You can also get confirmation of the service account that is running UPA (eg, the farm service account), and the number.


Our Nguyen Blog said...

Line #7 : Server Services applet? Where is this found?

Al said...

This is the Windows Server Services administrative tool that lists all services on the machine.

David said...

Brilliant. Thanks.