Not able to fetch the list of users of particular group
hello
i trying list of user of particular group, not returning anything. there 3 users in myo365 group.
$group="myo365" get-aduser -filter { memberof -recursivematch $group } -searchbase "dc=lc,dc=local" -searchscope subtree | select userprincipalname | export-csv "d:\users.csv" -notypeinformation -force
please let me know missing
avian
just clarify, problem original code cannot filter on memberof attribute, except comparing exact match of distinguishedname. dn format attributes, such memberof, have restriction. use ldap filter, must specify full dn of group. find direct members, use filter similar to:
-ldapfilter "(memberof=cn=myo365,ou=sales,ou=west,dc=domain,dc=com")
to query recursively (to reveal nested group membership), can use following similar filter:
-ldapfilter "(memberof:1.2.840.113556.1.4.1941:=cn=myo365,ou=sales,ou=west,dc=domain,dc=com)"
later must run against dc windows server 2003 sp2 or windows server 2008 or above. using get-adgroupmember easier.
richard mueller - mvp enterprise mobility (identity , access)
Windows Server > Windows PowerShell
Comments
Post a Comment