Monday, July 13, 2009

NDR message caused by delegate

One question that comes up often is why did I get this undeliverable message (NDR) when I send a meeting request to this user? Even better than the question is tracking down the answer. Well, I always like to script common tasks like this and I developed the following script. The script requires the a copy of the NDR message.

$start = Read-Host "Enter the start time"
$subject = Read-Host "Enter the message subject"
$start = [datetime]$start
$end = $start.AddMinutes(10)
$hub = Read-Host "Enter the transport server"
$mbx = Read-Host "Enter the mailbox server"
$mid = Read-Host "Enter the message ID"

$messages = Get-MessageTrackingLog -Server $mbx -Start $start -End $end -MessageSubject $subject -MessageId $mid -ResultSize unlimited Where { $_.SourceContext.Contains("MessageClass:IPM.Schedule.Meeting.Request") -eq $True -And $_.Server.Hostname -ieq $hub }
foreach($m in $messages)
{ $startChar = $m.SourceContext.IndexOf("Mailbox:") + 8;
$mbx = $m.SourceContext.Substring($startChar,36);
Get-Mailbox $mbx

You can reduce the lines of code, but I expanded it so that it is easier to follow what each line accomplishes.

No comments: