Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Exchange 2007 distribution list memeber count

Posted on 2008-10-22
5
Medium Priority
?
1,046 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 2000 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

Problems using Powershell and Active Directory?

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

If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
To show how to generate a certificate request 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 Servers >> Certificates…
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…
Suggested Courses

916 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