Blog Post

Skype for Business Blog
4 MIN READ

Script to delete SIP profile for multiple Lync 2013 users

NextHop_Team's avatar
NextHop_Team
Brass Contributor
May 20, 2019
First published on TECHNET on Sep 24, 2013

When a Lync 2013 desktop client for Windows signs-in, to minimize the bandwidth consumption the Lync client retrieves a lot of information from cache.  This cached information is stored in the users Sip profile in a folder named Sip_(SipURI of the user) located on a Windows computer in the following folder:

%UserProfile%AppDataLocalMicrosoftOffice15.0Lync

If there is any issue with the files in the sip profile user might experience issue with Lync client such as:


  • Contacts appear to be offline

  • You cannot search the Global Address List

  • Contacts are missing from the contact list

  • Contacts display Presence Unknown

  • Presence is not displayed in Outlook or SharePoint

To resolve the above issue exist of out of the Lync client delete the content of the sip profile folder or delete the sip profile folder itself. However, this is not a scalable solution for large organizations. To solve this problem, I have written a script that deletes the SIP profile folder on the user’s computer which in turn deletes the cache files used by Lync 2013

Note: When restarting the Lync after deleting the SIP profile folder, the client will attempt to download the address book file resulting in heavy bandwidth consumption. This script will delete all the sip profile folders under %UserProfile%.

'==========================================================================

'

‘NAME:  Delete sip profile

'

‘BY Edwin Joseph

'

‘COMMENT: This script deletes the sip profile for the user from machine if it exists

‘the purpose here is delete the cache files used by Lync 2013 client

'==========================================================================

Option Explicit

Dim objShell12

Dim objUserEnv

Dim strUserPro

Dim userProfile,SipProfile

Dim proPath

Dim objFSO

Dim objStartFolder

Dim objFolder

Dim colFiles

Dim objFile

Dim Subfolder

Dim uProfile

Set objShell12=CreateObject("WScript.Shell")

Set objUserEnv=objShell12.Environment("User")

strUserPro= objShell12.ExpandEnvironmentStrings(objUserEnv("TEMP"))

userProfile = objShell12.ExpandEnvironmentStrings("%userprofile%")

DeleteSip strUserPro 'delete user sip profile

'Delete sip Profile

SipProfile=userProfile & "AppDataLocalMicrosoftOffice15.0Lync"

uProfile=userProfile & "AppDataLocalMicrosoftOffice15.0"

Set objFSO = CreateObject("Scripting.FileSystemObject")

objStartFolder = uProfile

Set objFolder = objFSO.GetFolder(objStartFolder)

'Wscript.Echo objFolder.Path

ShowSubfolders objFSO.GetFolder(objStartFolder)

Sub ShowSubFolders(Folder)

For Each Subfolder in Folder.SubFolders

proPath = Right(Subfolder.Path,4)

'Wscript.Echo proPath

If proPath = "Lync" Then

DeleteSip SipProfile

End if

Next

End Sub

DeleteSip SipProfile

'this is also to delete user sip profile

SipProfile=SipProfile & "Sip_*"

DeleteSip SipProfile

WScript.Quit

Sub DeleteSip (strSipPath)

On Error Resume Next

Dim objFSO

Dim objFolder,objDir

Dim i

Set objFSO=CreateObject("Scripting.FileSystemObject")

Set objFolder=objFSO.GetFolder(strSipPath)

'delete folder

For i=0 To 10

For Each objDir In objFolder.SubFolders

objDir.Delete True

Next

Next

'clear all objects

Set objFSO=Nothing

Set objFolder=Nothing

Set objDir=Nothing

End Sub

'==================================================================

To use the script, do the following:


  • Copy the highlighted section and paste into Notepad.

  • Save the Notepad file as DeleteSipProfile.vbs .

This VBS file can be executed in multiple ways.

Method 1: Network share

This method requires end user assistance and awareness. This is, however, the fastest way to achieve the end result.


  • Copy the DeleteSipProfile.vbs to a network share that all users can access.

  • Train end users to exit Communicator or Lync, and then double click DeleteSipProfile.vbs .

  • When the user receives the message: Open File - Security Warning Click Run .

  • Re-start the Communicator or Lync client.

Method 2: Group policy

To use the group policy method, deploy the VBS file as a logon policy. All end users need to do is log off, then log on to their Windows workstation.


  1. Copy the DeleteSipProfile.vbs from the \domainSysvoldomainscripts folder.

  2. Create a new Group Policy Object.

To suppress the Open File - Security Warning


  1. Open the new Group Policy Object. In the left pane, expand User Configuration , and then expand Administrative Templates .

  2. Expand Windows Components , and then click Attachment Manager .

  3. In the right pane, double-click Default risk level for file attachments .

  4. Click the Setting tab, and then click Enabled .

  5. In the Set the default risk level drop down list, select High Risk .

  6. Click Apply , and then click OK .

  7. Double-click Inclusion list for low file types .

  8. Click the Setting tab, and then click Enabled .

  9. Enter the file types you don't want to be warned about in the box (for example: .vbs) in the Specify low risk extensions box.

  10. Click OK .

Deploying the logon script


  1. Open the new GPO In the left pane, expand User Configuration , and then expand Windows Settings .

  2. Click Script (logonlogoff) .

  3. In the right pane, double-click Logon .

  4. In the Logon Properties windows click Add .

  5. In the Script Name field type in \domainSysvoldomainscriptsDeleteSipProfile.vbs .

  6. Click OK .

  7. In the Logon Properties window, click Apply and then click OK .

  8. Link this new GPO to Users OU and, if possible, enforce it.

  9. Run GPupdate /force on the Domain Controller.

Note: Do not forget to unlink the policy after confirming that all users have logged out and logged in.

In this article we have examined how to delete Sip profiles on from multiple workstations using a script which in turn will delete cache files used by the Lync client. This script has been tested for both Windows 7 and above client operating systems as per System requirement for Office 2013 .


Updated May 20, 2019
Version 2.0