net stop sptimerv4
Get-SPDatabase // find sync db id.
$syncdb=Get-SPDatabase -Id
$syncdb.Unprovision()
$syncdb.Status=’Offline’
Get-SPServiceApplication // find UPS SA id.
$upa=Get-SPServiceApplication -Id
$upa.ResetSynchronizationMachine()
$upa.ResetSynchronizationDatabase()
$syncdb.Provision( )
net start sptimerv4
iisreset
另一份脚本, 列在这里供参考.
$db = Get-SPDatabase | Where-Object {$_.Name -eq "Sync DB"}
$syncdb=Get-SPDatabase -Id $db.Id
$syncdb.Unprovision()
$syncdb.Status='Offline'
$sa = Get-SPServiceApplication | where-object {$_.DisplayName -eq "User Profile Service"}
$upa=Get-SPServiceApplication -Id $sa.Id
$upa.ResetSynchronizationMachine()
$upa.ResetSynchronizationDatabase()
$syncdb.Provision()
参考资料:
<<Profile synchronization guide for Microsoft SharePoint Server 2010>>
本书的Maintain Profile Synchronization的部分有很多实用的步骤.
Maintain profile synchronization (SharePoint Server 2010) 68
------------------------------------
Task requirements 68
Procedures in this article 69
Rename users or change user domains 69
Exclude users whose accounts have been disabled 70
Remove obsolete users and groups 70
Maintain profile schema changes 72
Rename a profile synchronization server 72
Move the User Profile Synchronization service to a new server 72
Reset profile synchronization 73
Restrict profile synchronization communication to a specific domain controller 75
Adjust profile synchronization time-outs 76
这本书的下载地址如下.
http://www.microsoft.com/en-us/download/details.aspx?id=26832