Solved

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

Posted on 2014-04-13
9
177 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
  • 5
  • 4
9 Comments
 
LVL 19

Expert Comment

by:Patricksr1972
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 19

Expert Comment

by:Patricksr1972
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
 

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
Do email signature updates give you a headache?

Do you feel like all of your time is spent managing email signatures? Too busy to visit every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

 
LVL 19

Expert Comment

by:Patricksr1972
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 19

Expert Comment

by:Patricksr1972
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 19

Accepted Solution

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…
In this video we show how to create a mailbox database 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 >> Data…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now