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.
miki0Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Amit KumarCommented:
user this one after connecting Exchange online powershell

(get-distributiongroupmember -identity GroupName).count
0
arnoldCommented:
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.
0
miki0Author Commented:
It only gives me a number of sub-groups that are part of this group. :/
0
Increase Security & Decrease Risk with NSPM Tools

Analyst firm, Enterprise Management Associates (EMA) reveals significant benefits to enterprises when using Network Security Policy Management (NSPM) solutions, while organizations without, experienced issues including non standard security policies and failed cloud migrations

arnoldCommented:
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.
0
miki0Author Commented:
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?
0
arnoldCommented:
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...
0
miki0Author Commented:
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.
0
arnoldCommented:
Since you seem to need to run thi periodically defining your own function will do the repetitive

Have not worked it out but thought to include it
https://technet.microsoft.com/en-us/magazine/hh360993.aspx
Th combination of

To name the function
Get-allmembers  groupname  optional (counter)
One is a counter of users
For each group in get-distributiongroupmembers -identity groupname
Call the function with the new groupname and .....

The reference defines the function in your o365 .......
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
miki0Author Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Security

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.