Exchange 2007 distribution list memeber count

Is there a get command that I can use to get a count of how many members are in an Exchange 2007 distribution group?
33031aAsked:
Who is Participating?
 
dsolarisConnect With a Mentor Commented:
Save the tets into notepad and save it as a file, say c:\groupcount.ps1.
Open EMS and enter: C:\groupcount.ps1.
0
 
dsolarisCommented:
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
 
33031aAuthor Commented:
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
 
dsolarisCommented:
Did you save it as a ps1 file and run it by calling the script?
0
 
33031aAuthor Commented:
Thank you.  It worked perfectly!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.