Clearing Skype Cached data

Last year, I had a project that involved migrating a large customer from Office 365 Dedicated to Office 365 GCC (multi-tenant).  While Exchange hybrid moves were possible for the mailboxes, we were unable to perform the necessary hybrid migration configuration for Lync to migrate users.  While Lync was configured and available, not many end users actively used it.

To that end, we decided to just leave them as-is in the legacy environment and light up new accounts in Office 365.  We configured the appropriate Skype DNS entries (like _lyncdiscover, etc) and were off to the races.

It worked fine for people who had never used Lync or Skype before, but users who had previously logged into the old Lync environment kept trying to contact the previous environment, despite no DNS records pointing there.  The problem lies in the way Lync and Skype cache logon data.

After the first successful connection to Lync or Skype, a cache file directory is created at %userprofile%\AppData\Local\Microsoft\Office\x.xx\Lync\sip_<sipusername>.  You'll find the file endpointconfiguration.cache which has a whole bunch of stuff.  If you're curious to see a little bit of what it has:

 $cache = ((gc .\EndpointConfiguration.cache) -replace '[^a-zA-Z0-9!@#$%^&*(){}\\\/\:\.\"]','').Replace("!","`n").Replace(""""," - ")

It's not perfect by any means, but you should be able to decipher the URLs that are saved as part of the cache configuration:

So, regardless of whether or not you clear your sign-in credentials, this is the list of what Skype/Lync will attempt to connect to when launching.  The only ways to get Skype/Lync to ignore the cache file are:

  1. Block network access to the specified networks (firewall, null route, etc).
  2. Remove the Skype cache.

I'm not going to write routing statements or firewall rules for you (in this post--I've definitely got some things cooking since I lived a previous life as a Cisco guy), but I will give you a quick and dirty script to wipe out the cache per workstation.  You can add it to a computer start-up script to and execute once upon user login (maybe set a reg key in HKLM so you don't keep re-running it).

Of course, since this is a script that deletes things, it goes without saying to test this in your own environment.

You can get deleting to your heart's content here: