Solved

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

Posted on 2013-01-18
5
1,434 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
  • 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: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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
In-place Upgrading Dirsync to Azure AD Connect
In this video we show how to create a User Mailbox 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 Recipients >> Mailb…
This video discusses moving either the default database or any database to a new volume.

828 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