This will be likely one of my last Windows posts (more on that later). At work we did upgrade our OCS Server to Lync. Besides the annoyance of changing product name every two releases, this new version removed the possibility that existed in OCS to provision the contact groups for the ocs client. It was a WMI interface and it was quite handy.
Especially in cases where the rollout is not company-wide and users aren't sure who has Lync and who doesn't, having groups provisioned administratively is very handy. So I spent a couple of evenings solving this topic and it turned out that it's not really that difficult ;)
After poking a bit in the DB I noticed some handy stored procedures that would be quite handy. So I cooked up a script that takes a folder and for every csv file stored in that folder (one samaccount per line), it creates a group named as the file and it populates it with the users contained in that file. I.e.: the file IT-Dept.csv that contains users jon123 and joe456, will create a group called "IT-Dept" which contains both users and only for those two users.
Disclaimer: this script is still buggy, it's coded horrendously and it's a very quick hack. Backup your db before toying with it. I won't have time to clean it up or refine it so feel free to tweak it, put it on github etc ;)
Here it is: sync-lync-rosters.ps1