Script to Force Download of the Lync 2010 Address Book

Thursday, February 24, 2011
I wrote a script (batch file, really) that users can run to force a download of the Lync address book. 

The Lync address book is generated automatically on the Lync server every 24 hours at 1:30AM, local server time.  You can use the Update-CsAddressBook cmdlet on the Lync server to force the server to update the address book.  You will need to wait 5 minutes for the server to run the update.  Look for Lync Server event 21056 from LS Address Book Server to confirm that the address book update has completed, as shown below:

The address book is then downloaded locally by the Lync client in a randomized schedule from 1 to 60 minutes after the the user signs in.  Lync Server MVP Jeff Schertz wrote about this process in great detail in his post, Updating the Lync 2010 Address Book.

My script sets a GALDownloadInitialDelay key in the registry to force the Lync client to download the address book immediately after signing in.  It then enumerates all the SIP_* folders in the C:\Users\username\AppData\Local\Microsoft\Communicator folder and deletes the GalContacts.db and GalContacts.db.idx files which make up the Lync address book.
@echo off
echo Clearing Lync Address Books...
reg add HKCU\Software\Policies\Microsoft\Communicator /v GALDownloadInitialDelay /t REG_DWORD /d 0 /f
If %errorlevel%==1 goto Error
if "%LOCALAPPDATA%"=="" Set LOCALAPPDATA=%USERPROFILE%\Local Settings\Application Data
dir "%LOCALAPPDATA%\Microsoft\Communicator\sip_*" /b > list.txt
FOR /F "tokens=1" %%i in (list.txt) do del "%LOCALAPPDATA%\Microsoft\Communicator\%%i\gal*.*"
echo Sign out of Lync and sign back in to download the current address book.
goto End
echo You must run this command from an elevated Command Prompt.
Save the script above as ClearLyncAddressBook.bat and run it from an elevated Command Prompt.  Then sign out and back into Lync and the address book will download immediately.


  1. Don't forget that Lync is still an x86 client and if you're on a 64-bit OS, you still have to place the registry information in the WOW64 section of the registry.

  2. %LOCALAPPDATA% is available on Windows 7, but not on Windows XP.

  3. The GALDownloadInitialDelay registry key is stored in HKCU\Software\Policies, which works for both x86 and x64 computers. There is no WOW6432Node equivilant.

  4. I updated the script above to work for all versions of Windows, including Windows XP. Thanks for the suggestion!

  5. @ Jeff
    Thx for the script, i have been beating my head trying to figure out why Lync was not pulling images from AD. As soon as I ran your script and bounced the Lync Client all is well. Thanks again!

  6. Thanks jeff, this worked fine...

  7. You saved my day. Thanks a bunch!

  8. How can I open Lync Server 2010?

  9. Hi Jeff,
    Your script worked perfectly in our Win Xp environment to solve the problem with the Lync sync'ing. Thanks so much buddy!! You Rock.

  10. whoah this weblog is magnificent i love studying your posts.
    Stay up the great work! You recognize, a lot of people are searching
    around for this information, you can aid them greatly.
    Feel free to surf my site ost to pst

  11. Now if only I could find something like this for Lync for Mac..


Thank you for your comment! It is my hope that you find the information here useful. Let others know if this post helped you out, or if you have a comment or further information.