If you find yourself in a situation where you’ve exhausted normal efforts in fixing miscellaneous User Profile Synchronization (UPS) issues, a good final resort attempt can be done by following the below steps to reprovision UPS:
- Backup the User Profile DB and the User Profile Sync DB on your SharePoint SQL DB server (this is for ‘just in case’ something should go wrong in the following steps so you can restore the DB’s)
- Log on to your SharePoint App server with Farm account
- Stop the SharePoint 2010 Timer service:
- Stop SharePoint 2010 Timer from Services in Server Manager or ‘net stop sptimerv4’ from command line
Delete the data in the Sync DB using the following PowerShell commands:
- Open SharePoint 2010 Management Shell as administrator
- Type in ‘Get-SPDatabase’
- Copy the GUID associated with the User Profile Sync DB
- Type in ‘$syncdb=Get-SPDatabase –ID [paste GUID of UPS Sync DB]’
- Type in following in order, executing one by one:
- $syncdb.Unprovision()
- $syncdb.Status=’Offline’
- Get-SPServiceApplication
- Now locate and copy the GUID associated with the UPS to use in next command
- $ups=Get-SPServiceApplication –ID [paste GUID from above]
- $ups.ResetSynchronizationMachine()
- $ups.ResetSynchronizationDatabase()
- $syncdb.Provision()
- On the SharePoint SQL DB Server via SQL Studio Manager, add the UPS service account (farm account) as the DBOWNER on the Sync DB
- Start the SharePoint 2010 Timer service in Server Manager or ‘net start sptimerv4’ from command line
- Start the User Profile Synchronization Service in Central Admin
- After User Profile Synchronization Service is started (may take up to 10-20 mins), do a ‘iisreset /noforce’ on your SharePoint servers
- From Central Admin, go into Manage Service Applications, click an open your User Profile Service service application.
- Under Synchronization, click on Configure Synchronization Connections and create your data sync connection (AD)
- Once the connection is created, if you had any Connection Filters (such as Disabled Users), you will need to recreate them by clicking on the drop down next to your connection and select ‘Edit Connection Filters’. From experience, you may want to check the existing filters prior to performing this entire process to make sure you know what filters exist, as they will be wiped out once your start the above PowerShell sequence.
NOTE: If you also had any Property Mapping for Synchronization mappings setup (such as exporting users Picture (thumbnailPhoto) into Active Directory), you will need to set these back up as well. - After completed, proceed with running a Full User Profile Synchronization
As always, use the above provided instructions and PowerShell at your own risk, as every situation and SharePoint farm environment can differ.