?
Solved

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

Posted on 2010-09-22
3
Medium Priority
?
3,389 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/rece…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

649 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