Solved

How to get send receive mails on my exchange 2007 server.

Posted on 2014-04-13
9
183 Views
Last Modified: 2014-04-30
Hi,

I have exchange 2007 server running on windows 2003. I have to present information to my management regarding how many mails are send received on my exchange server per day for all users.

request you to tell me a way out.
0
Comment
Question by:kapoor_sumeet
[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
  • 5
  • 4
9 Comments
 
LVL 23

Expert Comment

by:Patrick Bogers
ID: 39997218
Hi

In ESM you have a mailflow checker, do not specify a sender nor a reciever. Just check per day week month or whatever you want.
0
 

Author Comment

by:kapoor_sumeet
ID: 39997225
Will it give consolidated report on .


Sent mails:
Size of sent mails:
 Size of biggest mail out:
 Average size out:
 Quantity incoming mails:  
 Average size in :
 Overall quantity :
 Overall size :
0
 
LVL 23

Expert Comment

by:Patrick Bogers
ID: 39997231
No it will not, it will only show sended and recieved mails.
To get deeper into what you want you can use a exchange powershell script as provided by MS to help you on your way. The link is here.
0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

Author Comment

by:kapoor_sumeet
ID: 39997235
I have found following script.

$Localhost = $env:COMPUTERNAME
 #Load Exchange PS Snapin
 If ((Get-PSSnapin | Where-Object {$_.Name -eq “Microsoft.Exchange.Management.PowerShell.E2010¿} ).name -eq ‘Microsoft.Exchange.Management.PowerShell.E2010')
 {
 Write-Host “Exchange Snapin is already loaded….”
}

else
 {
 Write-Host “Loading Exchange Snapin Please Wait….”; Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
 }
 Write-Host “running…”

$hubs = Get-TransportServer

# Get the start date for the tracking log search
 $Start = (Get-Date -Hour 00 -Minute 00 -Second 00).AddDays(-1)

# Get the end date for the tracking log search
 $End = (Get-Date -Hour 23 -Minute 59 -Second 59).AddDays(-1)

$Datum = $Start.ToShortDateString()

$receive = $hubs | get-messagetrackinglog -Start $Start -End $End -EventID “RECEIVE” -ResultSize Unlimited | select Sender,RecipientCount,TotalBytes,Recipients
 $send = $hubs | get-messagetrackinglog -Start $Start -End $End -EventID “SEND” -ResultSize Unlimited | select Sender,RecipientCount,TotalBytes
 $mreceive = $receive | Measure-Object TotalBytes -maximum -minimum -average -sum
 $msend = $send | Measure-Object TotalBytes -maximum -minimum -average -sum

$anzahl = $mreceive.count + $msend.count
 $volumen = ($mreceive.sum + $msend.sum) / (1024 * 1024)

$volumen = “{0:N2}” -f $volumen + ” MB”

$msendmb = $msend.sum / (1024 * 1024)
 $vsend = “{0:N2}” -f $msendmb + ” MB”
$bigsend = $msend.maximum / (1024 * 1024)
 $avsend = $msend.average / 1024

$bigsendmb = “{0:N2}” -f $bigsend + ” MB”
$avsendkb = “{0:N2}” -f $avsend + ” KB”

$mreceivemb = $mreceive.sum / (1024 * 1024)
 $vreceive = “{0:N2}” -f $mreceivemb + ” MB”
$bigreceive = $mreceive.maximum / (1024 * 1024)
 $avreceive = $mreceive.average / 1024

$bigreceivemb = “{0:N2}” -f $bigreceive + ” MB”
$avreceivekb = “{0:N2}” -f $avreceive + ” KB”

#$senders = $send | Group-Object Sender | Sort-Object Count -Descending
 #$topsender = $senders[0].Name
 #$topsender += $senders[0].Count

#$receivers = $receive | Group-Object Recipients | Sort-Object Count -Descending
 #$topreceiver = $receivers[0]
 #$topreceiver

$computer = gc env:computername
 $obj = new-object psObject

$obj |Add-Member -MemberType noteproperty -Name “Generated on server:” -Value $Computer
 $obj |Add-Member -MemberType noteproperty -Name “Date :” -Value $Datum
 $obj |Add-Member -MemberType noteproperty -Name “Sent mails :” -Value $msend.Count
 $obj |Add-Member -MemberType noteproperty -Name “Size of sent mails:” -Value $vsend
 $obj |Add-Member -MemberType noteproperty -Name “Size of biggest mail out:” -value $bigsendmb
 $obj |Add-Member -MemberType noteproperty -Name “Average size out :” -value $avsendkb
 $obj |Add-Member -MemberType noteproperty -Name “Quantity incoming mails :” -Value $mreceive.Count
 $obj |Add-Member -MemberType noteproperty -Name “Size of received mails :” -Value $vreceive
 $obj |Add-Member -MemberType noteproperty -Name “Size of biggest mail in :” -value $bigreceivemb
 $obj |Add-Member -MemberType noteproperty -Name “Average size in :” -value $avreceivekb
 $obj |Add-Member -MemberType noteproperty -Name “Overall quantity :” -Value $anzahl
 $obj |Add-Member -MemberType noteproperty -Name “Overall size :” -Value $volumen

$out = $Datum + “;” + $msend.count + “;” + $vsend + “;” + $mreceive.count + “;” + $vreceive + “;” + $anzahl + “;” + $volumen
 $out | out-file c:\daily.csv -append -encoding default

function sendmail($body)
 {
 $SmtpClient = new-object system.net.mail.smtpClient
 $MailMessage = New-Object system.net.mail.mailmessage
 $SmtpClient.Host = “YOUR_HT_SERVER”
$mailmessage.from = “Exchange_2010_NoReply@YOURDOMAIN.COM”
$mailmessage.To.add(“RECIPIENT@YOURDOMAIN.COM”)
 # $mailmessage.CC.add(“CC_RECIPIENT@YOURDOMAIN.COM”)
 $mailmessage.Subject = “Exchange daily message Report $Datum”
$MailMessage.IsBodyHtml = $false
 $mailmessage.Body = $body

$smtpclient.Send($mailmessage)
 }

$obj = $obj -replace(“@{“,””)
 $obj = $obj -replace(“=”,”:`t”)
 $obj = $obj -replace(“; “,”`n”)
 $obj = $obj -replace(“}”,”`n”)

sendmail $obj


Now how to run this script. Will batch file work or there is some other way to run it.
0
 
LVL 23

Expert Comment

by:Patrick Bogers
ID: 39997238
This is an powershell script which you need to call <filename>.ps1 and if i am not mistaken it needs the powershell snapin build into exchange (#Load Exchange PS Snapin)
0
 

Author Comment

by:kapoor_sumeet
ID: 39997249
Hi

Is powershell snapin there by default or it will load using this script. Other thing is if you can provide some link on how to run script.
0
 
LVL 23

Expert Comment

by:Patrick Bogers
ID: 39997254
By installing Exchange 2007 you also get the exchange toolbox which allows you to run powershell scripts.

Here is a quick guide true on how to use, for example, a mail diagnostics script.
https://www.youtube.com/watch?v=lEn6mjY4zws
0
 

Author Comment

by:kapoor_sumeet
ID: 39997268
hi

if I run following command on exchange powershell

.\xyz.ps1

xyz.ps1 is the script file then it will run script. Is it  the way to run script .

 Please help me I have not used powershell before.
0
 
LVL 23

Accepted Solution

by:
Patrick Bogers earned 500 total points
ID: 39997272
Yes that is the way to run a powershell script.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This article explains how to install and use the NTBackup utility that comes with Windows Server.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

726 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