?
Solved

Powershell Script--How find the number of members in a Distribution Group

Posted on 2013-01-18
5
Medium Priority
?
2,337 Views
Last Modified: 2013-01-18
Please provide the Powershell Script that will first grab all the DG's in my organization, then filter to provide me the ones with 100 members or more.

Please share.

Thanks!
0
Comment
Question by:Anthony K O365
  • 2
  • 2
5 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 38794150
Try this..
Get-DistributionGroup –ResultSize Unlimited | ? { (Get-DistributionGroupMember –identity $_.Name).Count –ge 100 }

Open in new window

Use Export-csv, If you want to export the details to CSV file..
0
 

Author Comment

by:Anthony K O365
ID: 38794228
Subsun,

While this seems to work, here is the error: (I'm using the -ResultSize Unlimited. Doesn't seem to be recognizing Unlimited.)

Any thoughts?



You must provide a value expression on the right-hand side of the '-' operator.
At D:\GetDG.ps1:2 char:88
+ Get-Distributiongroup | Where-Object { (Get-DistributionGroupMember -Identity $_.Name).Count -gt 100 - <<<< Resultsize Unlimited}    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : ExpectedValueExpression
0
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 38794257
Try it inside the closed bracket with Get-DistributionGroupMember..
Get-DistributionGroup –ResultSize Unlimited | ? { (Get-DistributionGroupMember –identity $_.Name –ResultSize Unlimited).Count –ge 100 }

Open in new window

0
 

Author Closing Comment

by:Anthony K O365
ID: 38794275
That did it!

Thanks!
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
How to effectively resolve the number one email related issue received by helpdesks.
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question