One Liners: Finding Elevated Accounts That Are Enabled For Lync & Skype for Business
One thing I see while doing Lync environmental health checks for some customers is some elevated accounts that are enabled for Lync. An example is members of the Domain Admins group. This can be somewhat problematic, especially for administration of those elevated accounts. For security reasons, it is not recommended to enable members of Domain Administrators group for Lync.
You cannot use Lync Server Control Panel to manage users who are members of the Domain Admins Active Directory group. For Domain Admins users, you can use Lync Server Control Panel only to perform read-only search operations. Attempting to perform write operations (such as enable or disable for Lync Server Control Panel, change pool or assigned policies, telephony settings, SIP address) on an elevated user will yield an “Access Denied” error. To perform write operations on a member of Domain Admins, you must use Lync Server Management Shell (PowerShell) cmdlets while logged on as a member of Domain Admins.
For more information please refer to this Microsoft page: User accounts enabled for Lync Server 2013
To query an elevated group, such as Domain Admins, for Lync enabled users, use the following:
(Get-ADGroupMember "Domain Admins").DistinguishedName | Get-CsUser -ErrorAction SilentlyContinue | Format-Table DisplayName,SipAddress
You can replace the “Domain Admins” with the name of any group, really. When you run it, you’ll end up with something like:
PS C:\> (Get-ADGroupMember "Domain Admins").DistinguishedName | Get-CsUser -ErrorAction SilentlyContinue | Format-Table DisplayName,SipAddress DisplayName SipAddress ----------- ---------- Services sip:services@contoso.com Dan Giles sip:dan.giles@contoso.com Neil Armstrong sip:neil.armstrong@contoso.com Dawn Lopes sip:dawn.lopez@contoso.com Bob Seger sip:bob.seger@contoso.com Gail O'Grady sip:gail.ogrady@contoso.com Troy Dallas sip:Troy.Dallas@contoso.com Steve Carrell sip:steve.carrell@contoso.com
You can Lync disable these users for Lync, using the Disable-CsUser cmdlet. This can be done either individually using the -Identity parameter, or everyone at once by pipeline, with something like:
(Get-ADGroupMember "Domain Admins").DistinguishedName | Disable-CsUser -ErrorAction SilentlyContinue
If you have some accounts that were previously members of an elevated group like Domain Admins, but no longer are, then the AdminCount parameter on their account may still be set. This will cause the Access Denied issue to continue. You can manually change this on the user object using ADSIEDIT, or via a script such as Set-AdminUser.
Follow Me