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 offSave 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.
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.
echo Sign out of Lync and sign back in to download the current address book.
goto End
:Error
echo You must run this command from an elevated Command Prompt.
echo.
:End
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.
ReplyDelete%LOCALAPPDATA% is available on Windows 7, but not on Windows XP.
ReplyDeleteThe GALDownloadInitialDelay registry key is stored in HKCU\Software\Policies, which works for both x86 and x64 computers. There is no WOW6432Node equivilant.
ReplyDeleteI updated the script above to work for all versions of Windows, including Windows XP. Thanks for the suggestion!
ReplyDelete@ Jeff
ReplyDeleteThx 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!
Thanks jeff, this worked fine...
ReplyDeleteYou saved my day. Thanks a bunch!
ReplyDeleteHow can I open Lync Server 2010?
ReplyDeletethanks dude
ReplyDeleteHi Jeff,
ReplyDeleteYour script worked perfectly in our Win Xp environment to solve the problem with the Lync sync'ing. Thanks so much buddy!! You Rock.
whoah this weblog is magnificent i love studying your posts.
ReplyDeleteStay 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
Now if only I could find something like this for Lync for Mac..
ReplyDelete