I recently experienced an issue at a customer whereby they had used the very helpful LyncAddContacts VBS script from the EXPTA blog, however this process had gone slightly wrong for the customer and they wanted to delete all contacts that had been pushed out to users and start again. Unfortunately the handy dbimpexp.exe tool does not allow you to explicitly delete contacts from users in bulk or individually. To get around this issue I utilised the following Microsoft SQL query against the Lync RTC database in order to delete a users contacts in their entirety. Please use the following information with caution, the query listed below modifies tables in the RTC database and should be used at your own discretion.
1. Using the Microsoft SQL Management Studio tools connect LyncServerName\RTC using an account that has full CSAdministrator rights.
2. When connected, under databases right click “RTC” and select “New Query”.
3. In the new query entry fieldtype the following:
DECLARE @RC int
DECLARE @_Owner nvarchar(4000)
EXECUTE @RC = [rtc].[dbo].[ImpDeleteContactGroups2] “[email protected]”
GO
4. Under the Execute command detailed above change the users SIP address to be the desired one. To run this for multiple people at once, add more Execute lines for each person and then click Execute in the tool bar to run the script
5. Once the query has run, log into the Lync 2010 client as the user(s) and ensure their contacts list is now blank.
That’s it, the process is complete.
Hi,
Can you perhaps help with an SQL script that extracts user contacts from the SQL Server?
We lost our CMS on Lync SE and need to rebuild everything but we would like to retain the users’ contacts.
Hi Danie,
you can achieve this through the Lync Management Shell or Command Prompt depending on your version of Lync, here’s a URL to another blog that may help: http://www.shudnow.net/2012/10/09/dbimpexp-exe-functionality-integrated-into-lync-2013-preview-management-shell/