Closed joncave closed 7 years ago
There are a couple more instances of the old patterns still present in Get-PrincipalContext
and Add-DomainGroupMember
. I'm confident they can be changed in a similar manner, but I haven't had a chance to test them out. I may follow up with a separate commit to address those.
Awesome, thanks!
If an object's distinguished name contains a comma then it ends up quoted. This may often happen in a user's common name when "surname, firstname" format is used. For example:
This breaks a number of functions which attempt to identify
DOMAIN\name
by matching on a \ anywhere in the specified identity before checking if the identity was a DN (or SID or GUID).For example, attempting to list members of "Domain Admins" using
Get-DomainGroupMember
gives the following:The fix implemented here is to perform more specific pattern matching prior to falling back to looking for a . The order is SID, DN, GUID, qualified name (
DOMAIN\name
), and then plain name.