Mailflow
Hello, I am using Exchange 2007 / Wind serv 2003. The mailbox = Exchange users and The mailuser = Linux Users (redirection) I would like to know all send emails passing by the Edges (would it be possible to include Edge 1 and Edge 2) and also the receive emails passing by the Edges. Therefore, I would like to know if a shell command could give me those results and if the resultat can be done on the 2 Edges (instead of running the command twice on one edge then on the other one) Thanks all in advance for you input.
May 18th, 2010 11:47pm

I usually get this information (along with other stats) from the message tracking logs on the Hub Transport servers. You can track email received via the Edge servers by looking for Receive events with a ClientIP that matches the Edge servers, and email sent via the Edge servers by looking at Send events with a ServerIP that matches the Edge server.$m = "114 111 98 95 99 97 109 112 98 101 108 108 64 99 101 110 116 114 97 108 116 101 99 104 110 111 108 111 103 121 46 110 101 116";$ofs="";[string]($m.Split() |% {[char][int]$_})
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2010 12:10am

Hello Mjolinor, I would be very interested in knowing how you "usually get this information (along with other stats) from the message tracking logs on the Hub Transport servers." In fact I have been recently asked to provide statistics and as I have never done it before I would really appreciate your help and any advice/links. I am though investiguating and found that: http://www.isaserver.org/tutorials/ISA-Server-2006-Installing-Enterprise-Edition-beta-Unihomed-Workgroup-Configuration-Post-Installation.html Thanks again. G
May 19th, 2010 9:12am

This is sample code to demonstate the process I use. Plug in the names of your hub transport servers, and the IP addresses of your Edge servers. It should give you the internet email stats for sent and received messages (message count and total bytes) from yesterday. $hubs = @("<hubservername1>","<hubservername2>") $edge_servers = @("<Edge1 IP>","<Edge2 IP>") $rec_msgs = @{} $rec_bytes = @{} $send_msgs = @{} $send_bytes = @{} $start = (Get-Date).adddays(-1).toshortdatestring() $end = (Get-Date).toshortdatestring() foreach ($hub in $hubs){ get-messagetrackinglog -server $hub -start $start -end $end -resultsize unlimited |%{ if ($_.eventid -eq "Send" -and $_.source -eq "SMTP"){ if ($edge_servers -contains $_.serverip){ $send_msgs[$_.serverip] ++ $send_bytes[$_.serverip] += $_.totalbytes } } if ($_.eventid -eq "Receive" -and $_.source -eq "SMTP"){ if ($edge_servers -contains $_.clientip){ $rec_msgs[$_.clientip] ++ $rec_bytes[$_.clientip] += $_.totalbytes } } } } Write-Host "Bytes received`n" $rec_bytes Write-Host "`nMessages received`n" $rec_msgs Write-Host "`nBytes Sent`n" $send_bytes Write-Host "`nMessages Sent`n" $send_msgs $m = "114 111 98 95 99 97 109 112 98 101 108 108 64 99 101 110 116 114 97 108 116 101 99 104 110 111 108 111 103 121 46 110 101 116";$ofs="";[string]($m.Split() |% {[char][int]$_})
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2010 6:24pm

Hello mjolinior, 1) Should I run your script from a mailbox server? 2) Would it be possible to base your existing shell cript to get the below infomation?? Period of time Start "01/04 /2010 00:00AM" End "30/04 /2010 11:59PM" Inbound Outbound mailbox 2000 300 mailuser 1000 400 Thanks again
May 20th, 2010 4:35pm

You should be able to run it on any machine that has the Exchange Management Shell installed. It will accumulate stats as far back as you have retained message tracking logs. If you've got message tracking logs back to 4/1, then it should be able to pull stats that far back. If the message tracking logs are large, it may take a while to run. I schedule a script to pull the stats I want to accumulate once a day in the wee hours of the morning when the servers are idle, for the previous day's logs, and save the data as .csv files. On the first day of each month, another script gathers up the .csv files for the previous month, and produces monthly statistics reports.$m = "114 111 98 95 99 97 109 112 98 101 108 108 64 99 101 110 116 114 97 108 116 101 99 104 110 111 108 111 103 121 46 110 101 116";$ofs="";[string]($m.Split() |% {[char][int]$_})
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2010 4:47pm

It worked well. I'll need to generate weekly report. How do u set the start and end date? $start = (Get-Date).adddays(-1).toshortdatestring() $end = (Get-Date).toshortdatestring() I guess it's on the above lines but don't wanna make a mistake :-) Even thoug result is great, I would need to separate/distinguish mailbox of mailuser. The mailbox represent the Exchange users in my org. About 500 users qnd the mailuser represents the linux users about 2000 users. Could we adapt your script to get the number of sent and receive for mailbox and mailuser per week and also per month??? Sorry for being so demanding graig
May 20th, 2010 6:00pm

You can do that. Basically it's a matter of adding some additional program logic to sort them out by domain. Easy to do on the sent items, since a given message will only have one sender. A little more difficult on the received, since a given message can have multiple recipients, and a given message could potentially go to both mailbox and mailuser recipients. You need to decide you how want to count the received stats. Does an incoming email to 3 recipients count as one email received, or 3? $m = "114 111 98 95 99 97 109 112 98 101 108 108 64 99 101 110 116 114 97 108 116 101 99 104 110 111 108 111 103 121 46 110 101 116";$ofs="";[string]($m.Split() |% {[char][int]$_})
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2010 6:12pm

This will translate to a midnight-to-midnight extract of the previous days data. If you want to just run it once a week, you can change it to: $start = (Get-Date).adddays(-7).toshortdatestring() $end = (Get-Date).toshortdatestring() and it will extract the data for the last 7 days. You can manually substitue start and end dates if you need an ad-hoc, custom report. $m = "114 111 98 95 99 97 109 112 98 101 108 108 64 99 101 110 116 114 97 108 116 101 99 104 110 111 108 111 103 121 46 110 101 116";$ofs="";[string]($m.Split() |% {[char][int]$_})
May 20th, 2010 6:17pm

After running the script I got the below result. It seems like "Name" "Value" should have been placed before "Bytes received". Also it only show the Edges, is that normal? Does it mean that it gathers data from hubcas as well and but the result as in "edge"? Bytes received = KB. Would it be possible to change it to MB for instance. Bytes received Name Value ---- ----- EDGE2 17986895 EDGE1 1395827922 Messages received EDGE2 573 EDGE1 17053 Bytes Sent EDGE2 431020756 EDGE1 403589362 Messages Sent EDGE2 2387 EDGE1 2373
Free Windows Admin Tool Kit Click here and download it now
May 21st, 2010 9:04am

To answer your prior question: "ou need to decide you how want to count the received stats. Does an incoming email to 3 recipients count as one email received, or 3?" --> Incoming email to 3 recipients would count as 3 emails. Many many thanks mjolinor.
May 21st, 2010 9:06am

The script was presented as sample code to demonstate how to get the data. I can give you examples to help you write a script to get this information from your logs, but I'm afraid I don't have the time to write a script for you, to your specifications. $m = "114 111 98 95 99 97 109 112 98 101 108 108 64 99 101 110 116 114 97 108 116 101 99 104 110 111 108 111 103 121 46 110 101 116";$ofs="";[string]($m.Split() |% {[char][int]$_})
Free Windows Admin Tool Kit Click here and download it now
May 21st, 2010 5:41pm

Hello mjolinor, I would be please to get some help about writing script. Thanks
May 25th, 2010 3:05pm

Okay. Is there any part of the script you don't understand so far?[string][char[]][int[]]("114 111 98 95 99 97 109 112 98 101 108 108 64 99 101 110 116 114 97 108 116 101 99 104 110 111 108 111 103 121 46 110 101 116" -split(" ")) -replace " "
Free Windows Admin Tool Kit Click here and download it now
May 25th, 2010 9:05pm

To be really frank with you I don´t get much about the script.. I will not be able to modify it or to change it. In fact, I get used to read it and it gets clearer, I understand some part but I have never received any training nor study it. So any help/docs would be really appreciated.. Though I don´t wanna abuse! Many thanks, Graig
May 27th, 2010 11:58pm

Okay. This is the original (V1) documentation pack. It's available for download for easy offline reading. It's a good basic primer in Powershell. http://www.microsoft.com/downloads/details.aspx?familyid=B4720B00-9A66-430F-BD56-EC48BFCA154F&displaylang=en If you have any questions, I recommend the Powershell Forum http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/threads or the Scripting Guys Forum http://social.technet.microsoft.com/Forums/en/ITCG/threads/ Post your questions there, and you'll have access to help from many experienced powershll scripters. [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
May 28th, 2010 12:35am

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

Other recent topics Other recent topics