3

We had a distribution group on Exchange 2010 which didn't had any members for long time (nobody noticed). What happens to the emails that come to such group? There was no return messages or anything.

4 Answers 4

7

Unfortunately all those emails have gone into the black hole. Exchange has done it's job, it looked up recipients but nothing exist, therefore discards the email. You would need an archive/compliance setup to retrieve those emails.

Also note: You would not receive any NDRs either, the process did completed as expected.

1
  • 1
    As I expected but wanted to confirm. Thanks
    – MadBoy
    Feb 16, 2012 at 11:14
3

They go nowhere unfortunately. We've set up a PowerShell script that runs daily and will email us if it finds empty distribution groups.

Just put this in a .ps1 file and schedule it to run at whatever interval you prefer.

$FromAddress = "[email protected]"
$ToAddress = "[email protected]"
$MessageSubject = "Empty distribution groups"
$SendingServer = "exchserver.example.com"

$groups = Get-DistributionGroup
$emptygroups = ($groups | ? { !(Get-DistributionGroupMember $_) })

if ($emptygroups.count -gt 0) {
    $MessageBody = "The following Exchange distribution groups have no members:`r`n`r`n"
    $MessageBody += ($emptygroups | Select-Object DisplayName | Out-String)

    $SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody

    $SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
    $SMTPClient.Send($SMTPMessage)
}
0
1

Here's an update on possible code. A more efficient query since it only returns a list of empty groups. A bit obtuse since one is led to think Get-DistributionGroup doesn't know about members (thus the need for the Get-DistributionGroupMember cmdlet).

$emptygroups = Get-DistributionGroup -Filter {members -eq $null}

I've confirmed that works on Exchange 2010, SP2, RU5v2.

0
1

Thanks! For me the nothing was happening with the above script - not sure if it's a different Powershell version or such like (Exchange 2010, Server 2008 R2) but there was nothing in the "count" attribute.

I had to replace:

if ($emptygroups.count -gt 0) {

With:

$emptygroupcount = echo $emptygroups | measure
if ($emptygroupcount.Count -gt 0) {

If anyone is wondering how to do a schedule of this, since the "basic" Powershell doesn't recognise the Exchange commands, I created a wrapper batch file as per http://social.technet.microsoft.com/Forums/exchange/en-US/0cad57bf-1113-4622-aac3-c3278fa97d72/how-to-schedule-a-powershell-script-through-schedule-tasks?forum=exchange2010

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .