Exchange Distribution List report with count

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 3 months ago.

  • Author
    Posts
  • #6497

    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,$c.count
    }

    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

You must be logged in to reply to this topic.