Skip to content

Instantly share code, notes, and snippets.

@mardahl
Last active January 2, 2023 17:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mardahl/d273060a94e91506364ed241c7d0da43 to your computer and use it in GitHub Desktop.
Save mardahl/d273060a94e91506364ed241c7d0da43 to your computer and use it in GitHub Desktop.
Script to force update Skype for Business Clients Global Address List
<#
.SYNOPSIS
Script to force update Skype for Business Clients Global Address List Written by Michael Mardahl (iphase.dk)
(Provided AS-IS! I will not be held liable for any negative consequences)
.DESCRIPTION
This script will shutdown the SfB client, update the registry and delete the GAL DB, then start the client again. It should be run in the users context as it does user specific things.
.EXAMPLE
Just run the script without parameters
.NOTES
user will need to have access to write to the registry key specified in this script.
#>
Write-Output "Stopping SfB client" Get-Process -ProcessName lync | Stop-Process
Write-Output "Identifying Office version (2013 or 2016)" switch (Test-Path "$($env:userprofile)\AppData\Local\Microsoft\Office\16.0") { $true {$ver = "16"} $false {$ver = "15"} }
Write-Output "Adding required key to registry" reg add HKLM\Software\Policies\Microsoft\Office$ver.0\Lync /v GalDownloadInitialDelay /t REG_DWORD /d 0 /f
Write-Output "Deleting SfB Client GAL db files"
#Remember to change the sipdomain.com text on these two lines, they should be your real domain (if in doubt, just look in that folder on your own client and see).
#You could also script a solution that fetches the users SIP address directly from Active Directory. I chose the easy way here...
Remove-Item "$($env:userprofile)\AppData\Local\Microsoft\Office$ver.0\Lync\sip$($env:username)@sipdomain.com\GalContacts.db" -force Remove-Item "$($env:userprofile)\AppData\Local\Microsoft\Office$ver.0\Lync\sip$($env:username)@sipdomain.com\GalContacts.db.idx" -force
Write-Output "Starting SfB client again" Start "C:\Program Files (x86)\Microsoft Office\root\Office$ver\lync.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment