Lync 2013 – Force the Lync client to always ‘show User Picture’ – video guide

Good Morning

This blog post and video guide describes how to force the Lync 2013 client to always show the end users Lync picture even after the user might have changed the setting not to show the picture.

pic1

To but a little bit of background around this, as with Lync 2010, Lync 2013 does not have the ability to block or stop a user from deselecting the option of showing their Lync picture.  This picture element is something I’m asked many times while working with customers.

I know this is something which we all would like as a option but as of today and as far as I’m aware this isn’t something close to Microsoft’s heart in fixing or providing a solution.

Also to confirm there isn’t any policies you can assign OR and registry setting to can associate to block the user changing their setting. So what solution and where is this setting stored….. Well its not in the xds database and actually its started within the front ends rtclocal database.

So to confirm before you go any further in the blog, I’m pretty certain that this solution will be one thats unsupported from Microsoft and also one that as we are going to change the rtclocal will be seen as a ‘borderline’ hack. Also i would like to point out I’ve ran this within my lab without issue for sometime, however i would suggest you test it within your lab area before you embark on using it in your production environment. <remember I hold no responsibility> 🙂

Ok no the small print is out of the way, what is the fix.. ?? Within the rtclocal there is a table called publishedstaticinstance which has a field that holds a massive binary value. As part of the challenge is to convert the binary into something thats readable and something we can update

pic2

Under the covers what this binary code states is DisplayADPhoto true/false.

So as part of the update we change for the status and update accordingly when the status is false.

As this is running on rtclocal, the way the guide runs this is via a scheduled task running a .ps1 powershell command. Also the SQL only checks the last 15 minutes of changes to reduce locks and database processing. Also the scheduled task I’ve created runs every 15 minutes so with the two you will never be out of sync with what a user is doing. (you could run this script more regular than every 15 minutes but given the requirement i think 15 is a good medium to use).

As for the SQL command some thanks go out to the tech net community as understanding the converts within the SQL was a slight challenge.

PS1. Script

function Enable-UserPhotos ($Domain, $OffSet) {(Get-CsPool (Get-CsComputer “$(hostname).$Domain”).Pool).Computers | % {Invoke-Sqlcmd -Query “update rtc.dbo.PublishedStaticInstance Set Data = CONVERT(image,convert(varbinary(4000),REPLACE(convert(varchar(4000),convert(varbinary(4000),Data)),'<displayADPhoto>false</displayADPhoto>’,'<displayADPhoto>true</displayADPhoto>’))) where [LastPubTime] >= DATEADD(mi,-$($OffSet),getdate()) AND convert(varchar(4000),convert(varbinary(4000),Data)) like ‘%<displayADPhoto>false</displayADPhoto>%’;” -ServerInstance “$($_)\RTCLOCAL”}
} Enable-UserPhotos -Domain ‘your domain name here’ -OffSet 15

KEY TAKEAWAYS

Remember the script is changing the rtclocal database on the fronted and this will be seen as not supported by microsoft.!

Video guide below.

Thanks!

Iain Smith

Advertisements

4 thoughts on “Lync 2013 – Force the Lync client to always ‘show User Picture’ – video guide

  1. Pingback: Lync 2013 – Force the Lync client to always ‘show User Picture’ – video guide | JC's Blog-O-Gibberish

  2. Hi Lain,
    Thank you for your post, it greatly help my organization.
    I have a small issue with the task scheduler.
    I followed your steps, but everytime I run the script from the task scheduler, the changes are not performed. To troubleshoot, I went to run from a DOS prompt (not powershell), and I run the command: powershell.exe c:\scripts\forcephoto.ps1
    I got an error: The term ‘Invoke-Sqlcmd’ is not recognized as the name of a cmdlet…….etc
    However, if I run the script directly from a powershell prompt, it works just fine.
    Any idea how I can fix this?
    Thank you.

  3. Thanks for this Iain, we are trying to adjust the select statement to highlight the people who have chosen to hide their photo so we can speak to them individually.

    However, upon running on the RTC DB my select statement is returning 4 results per user, and seems to be returning users who don’t actually have it hidden.

    The SQL I have patched together is:

    select UserAtHost,convert(varchar(4000),convert(varbinary(4000),Data))
    from PublishedStaticInstance,Resource
    where ResourceId = PublisherId
    and convert(varchar(4000),convert(varbinary(4000),Data))
    like ‘%false%’

    Have you any ideas?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s