Solved

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

Posted on 2013-01-18
5
1,159 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:kt KTAdmin
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Yagya Shree
ID: 38794102
0
 
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:kt KTAdmin
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 500 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:kt KTAdmin
ID: 38794275
That did it!

Thanks!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
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…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now