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
Solved

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

Posted on 2014-04-13
9
180 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 20

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 20

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 20

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 20

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 20

Accepted Solution

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

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
Find out what you should include to make the best professional email signature for your organization.
In this video we show how to create an Address List 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 Organization >> Ad…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

829 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