Get user count of shared groups


we have hosted environment.

toplevel domain \ customer \ company \ users
     \ company b \ users

and on.
have common ou share groups:

toplevel domain \ groups \ outlook group
 \ office group
 \ adove group

users companies can member of outlook group...its not mandatory. groups gives acces outlook program.

i script output number of users per company member of outlook group

company 2
company b 5

i have found script gives me total amount of users cannot see how many in company x

$users = (get-adgroupmember -identity "outlook group")
$users.count

is possible done?

if want take nested group memberships account, ldap syntax filter can modified follows:

$companya = get-aduser -ldapfilter "(memberof:1.2.840.113556.1.4.1941:=cn=outlook group,ou=groups,dc=mydomain,dc=com)" -searchbase "ou=company a,ou=customer,dc=mydomain,dc=com"
$companya.count

-----

this called ldap_matching_rule_in_chain. applies dn attributes. extended match operator walks chain of ancestry in objects way root until finds match. reveals group nesting. available on domain controllers windows server 2003 sp2 or windows server 2008 (or above).

i quoted above wiki article (note 10), documents many useful ldap syntax filters:

http://social.technet.microsoft.com/wiki/contents/articles/5392.active-directory-ldap-syntax-filters.aspx


richard mueller - mvp directory services



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS