?
Solved

Exchange 2007 get count of messages sent and received for the day

Posted on 2010-09-22
3
Medium Priority
?
3,332 Views
Last Modified: 2012-05-10
My manager was asking if there was any way to generate two "reports" from our exchange server. Ideally he would like a simple count of emails that were sent and received in a day. Something simple like

9/22/2010
Sent: 50,000
Received: 15,000

I dont know if this is possibly natively with exchange and powershell so Im hoping someone may know.
0
Comment
Question by:Joseph Daly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 26

Assisted Solution

by:e_aravind
e_aravind earned 1000 total points
ID: 33734872
Process Tracking Log tool for Exchange Server 2007
http://msexchangeteam.com/archive/2008/02/07/448082.aspx
0
 
LVL 8

Accepted Solution

by:
Mkris9 earned 1000 total points
ID: 33734880
0
 
LVL 12

Expert Comment

by:GusGallows
ID: 33743444
I generate the same report using the following PowerShell script:

#get a list of all hub servers (use the @() syntax so it will treat it as
#an array even if there is only one hub server)
$Hubs = @(Get-TransportServer)

#Get today's date for the output file
$date = ( get-date ).ToString('MM/dd/yyyy')

#Create the output file
$Out = "c:\temp\MsgCount.txt"

#Clear your counter variables
$Sent = 0
$Sent1 = 0
$Rcvd = 0
$Rcvd1 = 0

#Get today's date/time for the message logs
$EDate = get-date -uFormat '%D %r'

#Get date/time for the last 24 hours
$SDate = (get-date (get-date).AddDays(-1) -uformat '%D %r')

#go through each hub and count the messages for the Sent and Receive EventIDs.
#***NOTE*** Receive may or may not be what you are looking for. You can also
#try it with the Deliver EventID

foreach ($Hub in $Hubs)
{
      #count Sent messages
      $msg = @(get-messagetrackinglog -Server $Hub -EventID "Send" -Start "$SDate" -End "$EDate" -ResultSize Unlimited)
      $Sent1 = $msg.Count
      #add to total for all Hub servers
      $Sent = $Sent + $Sent1
      
      #Count received messages
      $msg2 = @(get-messagetrackinglog -Server $Hub -EventID "Receive" -Start "$SDate" -End "$EDate" -ResultSize Unlimited)
      $Rcvd1 = $msg2.Count
      #add to total for all hub servers
      $Rcvd = $Rcvd + $Rcvd1
}      

#Create your output and write it to the output file
out-File $Out -InputObject $date
$inp = "Sent: " + $Sent
out-File $Out -InputObject $inp -Append
$inp2 = "Received: " + $Rcvd
out-File $Out -InputObject $inp2 -Append

# Send Email with attached output file
Function Send-Mail
{
 $mail = New-Object Net.Mail.MailMessage
#Specify what email address to send the report from
 $mail.From  = "MsgReport@domain.com"
#Specify the recipient's email address
 $mail.To.Add("bossesEmail@domain.com")
 $mail.Subject = "Daily Message Count"
 $mail.Body = "Script generated report."
 $Attachment = New-Object Net.Mail.Attachment($Out)
 $mail.Attachments.Add($Attachment)
 $smtp = New-Object Net.Mail.SmtpClient
#Specify you SMTP Server
 $smtp.Host = "SMTPServer.domain.com"
 $smtp.Port = "25"
 $smtp.Send($mail)
}
Send-Mail
0

Featured Post

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question