When using the following function (compare 2 user's group membership), I get results that do not make sense.
function Compare-ADUserGroups
{ #requires -pssnapin Quest.ActiveRoles.ADManagement
param (
[string] $FirstUser = $(Throw "logonname required."),
[string] $SecondUser = $(Throw "logonname required.")
)
$a = (Get-QADUser $FirstUser).MemberOf
$b = (Get-QADUser $SecondUser).MemberOf
$c = Compare-Object -referenceObject $a -differenceObject $b
$c | Sort-Object InputObject
}
When I call this (Compare-ADUserGroups User1 User2), I get a result set similar to the following:
- CN=[All Users],OU=adm,DC=OSUMC,DC=EDU <=
- CN=[All Users],OU=adm,DC=OSUMC,DC=EDU =>
- CN=Extended Users,OU=MSG,DC=OSUMC,DC=EDU <=
- CN=Extended Users,OU=MSG,DC=OSUMC,DC=EDU =>
- CN=LCS2005,OU=Distribution Lists,DC=OSUMC,DC=EDU <=
- CN=LCS2005,OU=Distribution Lists,DC=OSUMC,DC=EDU =>
I would expect these to not show given that they are equal and I am not using the -IncludeEqual parameter. Any ideas on why these are showing up?