Track a mailbox delegate from an NDR
When a delegate mailbox is deleted without the owner mailbox removing the delegate, an NDR may be generated any time a meeting request is sent to the owner mailbox. The sender then complains that they didn't send the message to this user so why did they get this NDR. Well, I wanted to find a way to easily identify the mailbox configured with this delegate and I wanted to do it using Powershell. I created the following script (first version so it is a little rough, but gets the job done):There are a few items within this script that must be updated for your environment. functionfind-user ##ThisfunctionlocatesthemailboxassociatedwiththemsExchMailboxGuidfoundinthemessagetrackinglog### $users=Get-Mailbox-OrganizationalUnit"contoso.com/OU"-ResultSizeunlimited foreach($uin$users) {$dn="LDAP://"+$u.distinguishedName $user=[ADSI]$dn $gaGuidArray=$user.msExchMailboxGuid.value $adGuid=$gaGuidArray[3].ToString("X2")+$gaGuidArray[2].ToString("X2")+ $gaGuidArray[1].ToString("X2")+$gaGuidArray[0].ToString("X2")+"-"+ $gaGuidArray[5].ToString("X2")+$gaGuidArray[4].ToString("X2")+"-"+ $gaGuidArray[7].ToString("X2")+$gaGuidArray[6].ToString("X2")+"-"+ $gaGuidArray[8].ToString("X2")+$gaGuidArray[9].ToString("X2")+"-"+ $gaGuidArray[10].ToString("X2")+$gaGuidArray[11].ToString("X2")+ $gaGuidArray[12].ToString("X2")+$gaGuidArray[13].ToString("X2")+ $gaGuidArray[14].ToString("X2")+$gaGuidArray[15].ToString("X2") if($adGuid-eq$args[0]) {write-host$u.Name }}} ###EnterinformationprovidedwithintheNDR### $start=Read-Host"Enterstarttime" $subject=Read-Host"Enterthesubject" $start=[datetime]$start $end=$start.AddMinutes(10) $server=Read-Host"Enterthe server" $mid=Read-Host"Enterthemessageid" $messages=Get-MessageTrackingLog-ServerMAILBOXSRV-Start$start-End$end-MessageSubject$subject-MessageId$mid-ResultSizeUnlimited foreach($min$messages) ###Checktheresultsforonlymeetingrequests### {if($m.Sourcecontext.Contains("MessageClass:IPM.Schedule.Meeting.Request") -eq$True) ###Checkformessagescreatedbyarule### {if($m.SourceContext.Contains("ClientType:Transport")-eq$True) {if($m.ServerHostname.ToLower()-eq$server.ToLower()) {$startChar=$m.SourceContext.IndexOf("Mailbox:")+8 $mbx=$m.SourceContext.Substring($startChar,36 find-user$mbx }}}}
January 21st, 2009 10:21pm

I am posting an updated version of this script which is a little better than the original: ###InformationcanbefoundintheNDR### $start=Read-Host"Enterstarttime" $subject=Read-Host"Enterthesubject" $start=[datetime]$start $end=$start.AddMinutes(10) $server=Read-Host"Entertheowaserver" $mid=Read-Host"Enterthemessageid" $messages=Get-MessageTrackingLog-ServerMBXSRV-Start$start-End$end-MessageSubject$subject-MessageId$mid-ResultSizeUnlimited|where{$_.Sourcecontext.Contains("MessageClass:IPM.Schedule.Meeting.Request")-eq$True-and$_.SourceContext.Contains("ClientType:Transport")-eq$True-and$_.ServerHostname.ToLower()-eq$server.ToLower()} foreach($min$messages) {$startChar=$m.SourceContext.IndexOf("Mailbox:")+8 $mbx=$m.SourceContext.Substring($startChar,36) Get-Mailbox-OrganizationalUnit"contoso.com/OU"-ResultSizeunlimited|where{$_.ExchangeGuid-eq$mbx} }
Free Windows Admin Tool Kit Click here and download it now
January 22nd, 2009 11:57pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics