Link to home
Create AccountLog in
Avatar of miki0
miki0

asked on

count members in security group in o365

Is there a way to count the number of members that are part of security groups that are all part of a big security group.

Thank you.
Avatar of Amit Kumar
Amit Kumar
Flag of India image

user this one after connecting Exchange online powershell

(get-distributiongroupmember -identity GroupName).count
Avatar of arnold
To amit'.s point, over the past four months there are several questions/answers on this topic within EE dealing with using,powershell to run nested queries after using powershell to connect to office365 ps interafce.
Avatar of miki0
miki0

ASKER

It only gives me a number of sub-groups that are part of this group. :/
You have to nest .

Please provide as much detail as what the end result you want.

Do you want group
 Subgroup1
         Members of of group
           Subgrouba
               Members of
 Subgroup2
 


Repeat.

Or do you want to count members direct and based on nested groups.
Avatar of miki0

ASKER

Just looking for a total number of members that are part of this big group that doesn't have direct members  as users in, but rather sub-groups that have members. Does this make sense now?
One way is to get the aggregate, or have a report that
Top group
        Direct member
         Subgroup
                 Sub group members
                  Sub subgroup
                          Sub subgroup members
          Subgroup2
....

You possibly could maintain a central count of users, you enviably might get surprised how many members. And would need to ...

The iterative where you provide the root group, when a group is found, it will call the same function......

Let me work this through...
Avatar of miki0

ASKER

I have 174 or so universal-security "email enabled" groups, under one OU in AD called Security Groups. I am syncing them to O365 and have created one Distribution group in the cloud - O365 called "GroupOfTheDay" which these groups are part of, and every day different groups are part of this O365 distribution group. Those 174 universal groups in my AD are auto populated by our FIM. Things are changing from day to day so to have different groups as members is so annoying and gives me headaches. This script should have to be immune to those changes and always ready to give me the right and correct "Total" number of members-users that are part of this group for the day.
This is just a short story of otherwise same question I posted initially for this topic.
Thank you for the help in advance.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of miki0

ASKER

Thank you.