Solved

Exchange 2007 distribution list memeber count

Posted on 2008-10-22
5
1,013 Views
Last Modified: 2012-05-05
Is there a get command that I can use to get a count of how many members are in an Exchange 2007 distribution group?
0
Comment
Question by:33031a
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:dsolaris
ID: 22778401
Try this.  Simple input and output.

$groupname = Read-Host "Please Enter a Group Name"
$grpcount = 0
$data = Get-DistributionGroupMember -Identity $groupname
foreach ($i in $data)
{
      $grpcount = $grpcount + 1
}
write-output "Total Users in $($groupname):$grpcount"
0
 

Author Comment

by:33031a
ID: 22778560
So I ran this and got the following error:

Get-DistributionGroupMember : The operation could not be performed because object '$grpcount = 0' could not be found on domain controller 'domain controller name'.  
At line:1 char:36
+ $data = Get-DistributionGroupMember <<<< - Identity $groupname
0
 
LVL 3

Expert Comment

by:dsolaris
ID: 22778617
Did you save it as a ps1 file and run it by calling the script?
0
 
LVL 3

Accepted Solution

by:
dsolaris earned 500 total points
ID: 22778634
Save the tets into notepad and save it as a file, say c:\groupcount.ps1.
Open EMS and enter: C:\groupcount.ps1.
0
 

Author Closing Comment

by:33031a
ID: 31508806
Thank you.  It worked perfectly!
0

Featured Post

Does Powershell have you tied up in knots?

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

Utilizing an array to gracefully append to a list of EmailAddresses
Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
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…
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…

920 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

14 Experts available now in Live!

Get 1:1 Help Now