So there’s quite a few blog posts around about how to set a user to use their AD photo instead of a photo they select by specifying an http path – this is not one of them. What I’m offering here is a way to administratively update which picture option is selected on all your Lync clients, Forcing them to all be set to a particular value. If that sounds interesting, read on…
Lync’s Set-csClientPolicy -DisplayPhoto settign gives you three options. These work by slowly ratcheting down which options the end user has available to them.
- AllPhotos – user can select either “Show a picture from a web address” “Default corporate picture” or “Do not show my picture”
- PhotosFromADOnly – user can no longer select “Show a picture from a web address” but they’re still allowed to select between “Default corporate picture” and “Do not show my picture”
- NoPhoto – self explanatory
Great – so what if I have a company full of introverts that are all setting their picture settings to “Do not show my picture” and I want to administratively make them knock it off. Lync can’t help you there, but I can…
So, what happens when I select one of those pesky little options in my Lync client configuration/my picture screen? Lync sends a SERVICE message to your FE updating your contactCard with a change to the displayADPhoto and photo tags. These changes are written right to our old friend the rtc database’s PublishedStaticInstance table. Buried in that table is a column “Data” of type image which upon cursory examination is a giant messy ball of hex – but give this a try and see what’s really in there
select convert(varchar(4000),convert(varbinary(4000),Data))
from rtc.dbo.PublishedStaticInstance
Poof – magic
Now buried under all these static publications are your users settings for which photo to display – try this
select UserAtHost,convert(varchar(4000),convert(varbinary(4000),Data))
from PublishedStaticInstance,Resource
where ResourceId = PublisherId
and convert(varchar(4000),convert(varbinary(4000),Data))
like '%<displayADPhoto>%'
What you’ll see here are all of the modified contact card information for people who have manually select which picture they want to use – just people that have overridden the default selection and their contact cards.
Great – so what?
Well, if I wanted to just go blasting through the database and forcing everybody who’s manually selected “Do not show my picture” back to “Default corporate picture” I could do just that.
update PublishedStaticInstance set Data = CONVERT(image,convert(varbinary(4000),
REPLACE(convert(varchar(4000),convert(varbinary(4000),Data)),
'<displayADPhoto>false</displayADPhoto>',
'<displayADPhoto>true</displayADPhoto>')))
where convert(varchar(4000),convert(varbinary(4000),Data))
like '%<displayADPhoto>false</displayADPhoto>%'
Now, before you go off monkeying with the contents of your rtc database – be forewarned. Microsoft never intended that the end user mess with the contents of this database and if you crater your environment because you ran this SQL query, it’s not my fault. I’m just some guy on the internet and you should know better than to go running code you get off the internet on your production Lync environment without THOUROUGHLY TESTING AND VETTING IT YOURSELF IN A TEST ENVIRONMENT. MS support’s is only going to help you fix your environment by helping you restore your rtc database backup (so you better have one).
One last note – this little sql script only tatoo’s all your users contactCard publications with the displayADPhoto/true flipping them from whatever they set manually to “Defualt corporate picture”. It’s not a permanent fix. To make it more “permanent” you’re either going to need to schedule this script to run periodically, or change it into a trigger on the PublishedStaticInstance database or something.