Author: Edwin Joseph
Publication date: September 24, 2013
Product version: Lync Server 2013
Introduction
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%.
The Script
'==========================================================================
'
‘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
'==================================================================
How to Use the Script
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.
- Copy the DeleteSipProfile.vbs from the \domainSysvoldomainscripts folder.
- Create a new Group Policy Object.
To suppress the Open File - Security Warning
- Open the new Group Policy Object. In the left pane, expand User Configuration , and then expand Administrative Templates .
- Expand Windows Components , and then click Attachment Manager .
- In the right pane, double-click Default risk level for file attachments .
- Click the Setting tab, and then click Enabled .
- In the Set the default risk level drop down list, select High Risk .
- Click Apply , and then click OK .
- Double-click Inclusion list for low file types .
- Click the Setting tab, and then click Enabled .
- 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.
- Click OK .
Deploying the logon script
- Open the new GPO In the left pane, expand User Configuration , and then expand Windows Settings .
- Click Script (logonlogoff) .
- In the right pane, double-click Logon .
- In the Logon Properties windows click Add .
- In the Script Name field type in \domainSysvoldomainscriptsDeleteSipProfile.vbs .
- Click OK .
- In the Logon Properties window, click Apply and then click OK .
- Link this new GPO to Users OU and, if possible, enforce it.
- 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.
Summary
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 .