Wednesday, November 30, 2011

Enable or edit Lync users based on AdGroupMembership

In my previous blogposts on Lync user management using PowerShell, I have demonstrated how you can edit  by using an OU search string, or import a csv file. I thought maybe it would be nice to show how to add/manage Lync users by searching for a AD Group. It might be a bit tricky, but it is possible.

I have created a tiny script to prompt the admin for the group name, find users within that group, enable them for Lync and finally enabling the user for Enterprise voice (Presuming the phone attribute in AD is populated in the correct E.164 format, or the script might need adjustment) and setting a specific policy (just because I can, not because I have to).

Something worth mentioning, the set-csuser doesn't seem to like being pipelined to, which is why the get-adgroup is run twice.

The first part of the script is not doing anything, it's just a reminder to import the ad module. The first thing you have to do, is to enter the ADGroup Name (the display name of the group).


When the ADGroup is known to the script, we move on to enabling those users for Lync (skip this part if they are already enabled, but you want to edit users). This is quite straight forward.


But I'm not done yet. I also want to enable the user for voice, and grant him a client policy (These are just examples. Your imagination of PS command combinations is your only limitation).

Doing all I wanted to gave me an unexpected problem. As it turns out, the "get-adgroupmember" will not return the phone property of the user, and it became a challenge to figure out a way to get that property. That is why there are two foreach statements with in this last section. After we get hold of the adgroupmemner name, we can run the get-csaduser with that name (A bit dirty? I know, but it works).


As you can see, the script is fetching the $_.phone attrib of the user, and uses it to create the LineURI after adding the "tel:" prefix.

If you want to take a closer look at the actual script, it can be found right here. Have fun playing with it :)

0 comments:

Labels

Lync (15) Microfoft Lync Server 2010 (15) Microsoft (14) Windows (12) Cisco (11) Voice (11) OCS 2007 (9) CCIE (8) CUCM (8) OCS 2007 R2 (8) Windows Server 2008 (8) Powershell (7) Certifications (5) Internetworkexpert (5) Lab (5) Server (5) Beta (4) CUCM 7 (4) CUCM 8 (4) Freeware (4) MS Exchange (4) Mediation Server (4) Microsoft Office Communicator 2007 R2 (4) Software (4) Unified Messaging (4) Virtual Machine (4) Windows Live (4) Browser (3) CAC (3) Call Manager (3) Chrome (3) Google (3) Graded Labs (3) IPT (3) Iewb-vo-vol1 (3) Install (3) Internet (3) SQL 2008 (3) Upgrading (3) Virtual PC (3) Windows 7 (3) Windows Server 2008 R2 (3) enable-csuser (3) import-csv (3) set-csuser (3) Active Directory (2) Address Book (2) Bandwidth Management (2) Blog tool (2) CUCILYNC (2) Certificate (2) Exchange 2010 (2) Exchange Roles (2) HYPER-V (2) IIS (2) MTP (2) New-aduser (2) R2 (2) Remote control (2) SIP (2) SIP Trunk (2) SQL (2) SSL (2) UC (2) USB (2) User (2) VMWare (2) Virtual Server (2) Voice policies (2) get-adgroup (2) get-adgroupmember (2) 074-924 (1) 0x80070534 (1) 0xC3EC796C (1) 32bit (1) 350-030 (1) 443 (1) 5062 (1) 64bit (1) A/V authentication (1) ADDS (1) Application server (1) Assigned (1) Attendant (1) Brussels (1) CD (1) COMMUNICATIONS MANAGER (1) CUCIMOC (1) CUPS (1) CWA (1) Certificate Authority (1) Certification (1) Charter Member (1) Cisco Presence (1) Communicator Web Access (1) Conference (1) DL360 (1) DNS (1) Deployment (1) Desktop (1) Digit manipulation (1) Domain (1) Dual-boot (1) ESX (1) EWS (1) Edge (1) Encryption (1) Enterprise Voice (1) Error 3221684226 (1) Error 404 (1) Error 503 (1) Event ID 32018 (1) Exchange (1) Exchange 2007 (1) FTP (1) Fail (1) Filemerge (1) Front-end server (1) General network (1) Global Knowledge (1) HCL (1) HD (1) HP (1) HTC Touch (1) INVITE (1) Just for fun (1) Limited External Calling (1) LineURI (1) Linux (1) Livemeeting (1) Lync Server SDK 2010 (1) Lync client (1) MAPI (1) Microsoft Communications Server R2 Attendant (1) Microsoft® Community Contributor Award (1) NTP (1) Netwise CMG (1) Netwise CMGVoice (1) New-CsNetworkBandwidthPolicyProfile (1) New-CsNetworkRegion (1) New-CsNetworkSite (1) New-CsNetworkSubnet (1) Normalization (1) OCS validation (1) Office 2007 (1) Office 2010 (1) PSTN GW (1) Planning Tool (1) RC (1) RDP (1) RSAT (1) Rundtomrundt (1) SDelete (1) SP1 (1) SP3 (1) Sipreroute (1) Switchboard (1) Sysadminday (1) Sysinternals (1) System administrator (1) TeamViewer (1) Topology Builder (1) Translation-rule (1) TrueCrypt (1) Twitter (1) UC520 (1) UM (1) Ubuntu (1) Ubuntu 9 (1) Unassigned (1) Windows Firewall (1) Windows Vista (1) Windows XP (1) aboutme (1) csps (1) cspshell (1) csv (1) get-aduser (1) get-csaduser (1) grant-csdialplan (1) grant-voicepolicy (1) new-csserverapplication (1) notepad (1) passwords (1) set-aduser (1)