Solved

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

Posted on 2013-01-18
5
1,679 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:K Anthony O365
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:K Anthony 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 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:K Anthony O365
ID: 38794275
That did it!

Thanks!
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

In-place Upgrading Dirsync to Azure AD Connect
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this video we show how to create an Address List 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 Organization >> Ad…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

687 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