Exchange Distribution List report with count

Welcome Forums General PowerShell Q&A Exchange Distribution List report with count

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 8 months ago.

  • Author
  • #6497

    Topics: 1562
    Replies: 0
    Points: 0
    Rank: Member

    by link12 at 2012-12-03 11:11:45

    I'm trying to get a report built out for our Exchange distrubtion groups, both dynamic and regular. I have this so far for regular.

    #$a = Get-DistributionGroup (remarked for now until I can get a small test working)

    ### This is only for standard Distribtuion Groups.

    $a = get-content "c:\stuff\scripts\listtest.txt"
    foreach ($i in $a) {
    $c = Get-DistributionGroupMember $i

    I would like this into a CSV file, but have not been successful. My shell out put for the above code is

    name (from text file)
    user count from within the group

    I'm basically looking for a CSV with the following

    Name of DL, Count of Users, Is this Dynamic or Standard

    Just looking for some guidance on this one.

    by RichardSiddaway at 2012-12-05 04:41:22

    Try something like this

    $data = @()
    $dls = "AAAA", "BBB"

    foreach ($dl in $dls) {

    $data += New-Object -TypeName PSObject -Property @{
    Name = $dl
    Count = (Get-DistributionGroupMember -Identity $dl | Measure-Object).Count

    $data | Export-Csv -Path mydllist.csv -NoTypeInformation

    by link12 at 2012-12-05 05:30:56

    Great, works good!! Thanks

    by RichardSiddaway at 2012-12-05 09:41:40

    You are very welcome

The topic ‘Exchange Distribution List report with count’ is closed to new replies.