?
Solved

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

Posted on 2013-01-18
5
Medium Priority
?
1,905 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
[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: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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
A couple of months ago we ran into an issue that necessitated re-creating our Edge Subscriptions. However, when we attempted to execute the command: New-EdgeSubscription -filename C:\NewEdgeSub_01.xml we received an error indicating that the LDAP se…
In this video we show how to create a Contact 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 >> Contact ta…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

764 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