Exchange 2010: Find unused distribution lists

Many distribution lists quickly become confusing, but cleaning up distribution lists can be difficult if you don't know how often they are used. I have created a small script that counts how many mails have been sent to a list in the last few days. The time period is customizable. However, it must be ensured that the message tracking logs go back far enough.

Here is the script:

#-----------------------------
# Find unused distributors
# www.frankysweb.de
#
# by Frank Zöchling
# Version 0.1
#
#-----------------------------

$unuseddays = "30"

$distrigroups = Get-DistributionGroup
$htservers = get-transportserver
$end = get-date
$start = $end.addDays(-$unuseddays)

foreach ($distrigroup in $distrigroups)
{
$mailaddress = $distrigroup.PrimarySmtpAddress
$displayname = $distrigroup.DisplayName
foreach ($htserver in $htservers)
{
$mailsreceive = get-messagetrackinglog -Recipients:$mailaddress -Server $htserver -start $start -end $end -eventid receive | measure-object | foreach-object {$_.count}
$count = $count + $mailsreceive
}

$result+=@{$Displayname="$count"
}

$count = 0

}

$result

The

As you can see, the script is not particularly complex and can be quickly adapted to build a PRTG or Solarwinds monitor, for example. Or you can run the script once a month and have the values written to a CSV file, or or or or...

5 thoughts on “Exchange 2010: Ungenutzte Verteilerlisten finden”

  1. Hi einfach nur zur Vollstaendigkeit
    WARNUNG: Das Cmdlet „Get-TransportServer“ wird in einer künftigen Version von Exchange entfernt. Verwenden Sie
    stattdessen das Cmdlet „Get-TransportService“. Wenn in Skripts das Cmdlet „Get-TransportServer“ verwendet wird,
    aktualisieren Sie die Skripts, sodass sie das Cmdlet „Get-TransportService“ verwenden. Weitere Informationen finden Sie
    unter „http://go.microsoft.com/fwlink/p/?LinkId=254711“

    Gruss

    Reply
  2. Hallo Frank,

    beim Ausführen diesn Skripts, bekomme ich folgende Warnung:

    WARNUNG: Es sind mehr Ergebnisse verfügbar, als aktuell angezeigt werden. Erhöhen Sie den Wert des ResultSize-Parameters, um sie anzuzeigen.

    Gruß Daniele

    Reply
    • Hallo,
      ändern Sie bitte die Zeile mit „..-eventid receive | measure-object …“ wie folgt ab: „… -eventid receive -resultsize unlimited | measure-object …“

      Gruß, Frank

      Reply

Leave a Comment