Share via


Powershell: How to re-provsion the sync DB to resolve the issue that User Profile Synchronization Service fails to start?

You can use the below script:

==================================

Get-SPDatabase $syncdb=Get-SPDatabase -Id

$syncdb.Unprovision()
$syncdb.Status='Offline'
Get-SPServiceApplication
$upa=Get-SPServiceApplication - Id
$upa.ResetSynchronizationMachine()
$upa.ResetSynchronizationDatabase()
$syncdb.Provision()