http://blog.schertz.name/2010/09/updating-the-lync-2010-address-book/
The overall process is basically the same as what Office Communications Server does (covered in this past article), but with added flexibility of easily customizing some of the timing of the different events. The entire process happens over time based on a number of intervals, and by default looks like this:
- Changes performed on Active Directory objects are automatically synchronized by the LS User Replicator once every 60 seconds. These changes are written into the back-end SQL database for the pool as well as the rtcab database which is used by Address Book Web Query service for the Lync 2010 Mobile client.
- Once every 24 hours (1:30AM local server time) the LS Address Book Server will execute a synchronization pass which pulls the most recent information stored in the SQL rtc database and writes those changes into the address book files.
- On a randomized schedule the Lync client and Lync Phone Edition clients download any updated .lsabs and .dabs files from the Lync Server’s share to update the client’s local GalContacs.db cache file.
- Just as with OCS there are many scenarios when waiting a ‘day or so’
to see changes appear in the contact list are less than ideal, so the
manual steps have been outlined in detail in this article.
Understanding the Process
The first two items on the list above are both server-side processes are are controlled individually by separate Set and Update cmdlets. Since PowerShell cmdlets are now used for any and all configuration this means that separate command-line tools like lcscmd.exe or abserver.exe are no longer used in Lync Server. The ‘abserver.exe –RegenUR’ command has been replaced by Update-CsUserDatabase and the ‘abserver.exe –SyncNow’ command has been replaced by Update-CsAddressBook.- Let us first look at the User Replicator configuration, which is the
process which synchronizes data between Active Directory and the Lync
SQL databases.
- Execute the Get-CsUserReplicatorConfiguration cmdlet.
PS C:\> Get-CsUserReplicatorConfigurationThe ReplicationCycleInterval value indicates the default behavior of Lync Server to search Active Directory for any changes every minute. This interval is 1 minute by default and can be customized to any value between 1 second and 24 hours.
Identity : Global
ADDomainNamingContextList : {}
ReplicationCycleInterval : 00:01:00
The second half of the server-side process is controlled by the Address Book Service which pulls information from the SQL database and writes the changes to the address book files.
- Execute the Get-CsAddressBookConfiguration cmdlet.
PS C:\> Get-CsAddressBookConfigurationNoteworthy here are the SynchronizePollingInterval and RunTimeofDay settings. The default RunTimeofDay value of 1:30 AM is the same setting that OCS used and is still indicative of the one time per day that Lync Server automatically updates the address book files automatically.
Identity : Global
RunTimeOfDay : 1:30 AM KeepDuration : 30
SynchronizePollingInterval : 00:05:00 MaxDeltaFileSizePercentage : 20
UseNormalizationRules : True
IgnoreGenericRules : False
EnableFileGeneration : True
The SynchronizePollingInterval is how often the abserver.exe process checks for a pending synchronization event. Basically when the Update-CsAddressBook cmdlet is run then a ‘synchronize now‘ event is marked and the update is not actually run immediately. The event itself happens the next time abserver looks to see if a sync event has been triggered. This polling interval is 5 minutes by default and can be customized to any value between 5 seconds and 3 hours.
Update Servers
Because Step #1 in the process happens by default every minute then any recent changes in AD should already be imported into the SQL database. If this is not the case or for some reason normal replication is failing then a manual process can be used to toss out the entire copy of AD information in the SQL database’s address book store and regenerate a completely new copy. To rebuild Lync’s copy of the AD data simply use the Update-CsUserDatabase cmdlet. Be aware that is stuff is more process intensive than the automatic delta synchronization. This step should not be necessary under normal circumstances.In the time it took to read the previous paragraph Lync Server should have synchronized and outstanding changes in Active Directory and Step #2 can be manually processed.
- Execute Update-CsAddressBook to trigger the Lync Server to synchronize current Active Directory information in the SQL database into the downloadable client and device address book files. (The -verbose switch was used in the example below to display the informational text; it is not required when running the cmdlet.)
- After 5 minutes check the Lync Server event log on the server for a group of LS Address Book Server event reporting the results of the update command.
-
The contents of the four LS Address Book Server informational events show the triggered update and the results. The number of OC delta files written” shows that 40 new contacts were created, reflecting the new user accounts previously added into Active Directory and enabled for Lync Server.
Event ID: 21005
Description: Synchronization pass started.
Event ID: 21010
Description: Synchronization pass completed successfully. Address Book web service backend data partition = RtcAb1
Event ID: 21056
Description:
Synchronization Pass Summary. Sync pass completed with 11 contacts processed
Number of separate AD partitions: 1
Number of valid contacts: 11
Number of empty contacts: 0
Number of invalid contacts: 0
Number of cached photos deleted: 0
Number of stale OC files deleted: 0
Number of OC full files written: 1 with 11 total contacts
Number of OC delta files written: 8 with a total of 40 new/updated contacts and 0 deleted contacts. Number of OC bytes written: 10,072 compressed to 7,134 bytes on disk.
Number of stale device files deleted: 0
Number of device full files written: 1 with 0 total contacts
Number of device delta files written: 11 with a total of 0 new/updated contacts and 0 deleted contacts.
Number of device bytes written: 1,657 compressed to 1,248 bytes on disk.
Event ID: 21004
Description:
Next synchronization pass will start at: 9/24/2010 1:30:00 AM
Update Clients
Just as Office Communicator has done since a later R2 hotfix, Lync also will not immediately download changes to the Address Book files when first launched, but instead wait for a random interval of time between 1 and 60 minutes. To trigger an immediate download two steps must be taken on the client workstation. The first step only needs to be performed once per workstation, while the second would be done each time a forced update is desired.- First, execute the following command from the Windows Command Prompt run as an administrator (or manually add the GalDownloadInitialDelay registry key). Setting this value to 0 will force Lync to immediately download the address book instead of randomly selecting a time to check the server.
reg add HKLM\Software\Policies\Microsoft\Communicator /v GalDownloadInitialDelay /t REG_DWORD /d 0 /fTake note that the there is another difference here between the Lync and Communicator clients. For standard 32-bit operating systems the registry path below is the same regardless of the client versions (OC 2007 R2 with July 2009 update or Lync 2010 RC) but previously 64-bit operating systems running the 32-bit only OC 2007 R2 client had to have the setting created under the Wow6432Node policies key.
- Second, exit the Lync client and manually delete the GalContacts.db and GalContacts.db.idx files from the user’s profile directory. If the .db file still exists during startup of the client then Lync may still wait for that random interval between 0 and 60 minutes before checking for changes on the server’s address book files. By deleting the file the Lync client must download an entire new copy, forcing it to pick up any changes.
On Windows XP workstations:
%userprofile%\Local Settings\Application Data\Microsoft\Communicator\sip_<username@domain>\
On Windows Vista or Windows 7 workstations:
%userprofile%\AppData\Local\Microsoft\Communicator\sip_<username@domain>\
- Restart the Lync client and search for any of the recently changed information, for example the Telephone Number added to this AD user account now appears for the Lync contact.