Posted on 2011-03-16
Last Modified: 2012-05-11
Hi is there a script i can use to run a report on Exchange 2007 to see how many users have sent emails internal and external.
Need it for inbound and out bound

Thank you

Question by:happyexchange
LVL 12

Expert Comment

ID: 35146270
There is no direct partial script that will do this, but there is a Microsoft tool called the profile analyzer that will examine a set of mailboxes until you average sizes, amount of sent data, etc. It does not sound like exactly what you want, but it is the closest thing that I believe exists.
LVL 13

Accepted Solution

soostibi earned 500 total points
ID: 35157192
This is a little statistics from the message tracking logs. This works in a single-Exchange-server environment.
$mailboxes = @{}

$domains = Get-AcceptedDomain | ?{$_.domaintype -eq "authoritative"}| Select-Object -ExpandProperty domainname | Select-Object -ExpandProperty domain
Get-MessageTrackingLog -ResultSize unlimited |?{$_.recipients} |%{
    $status = "$($_.eventid)-$($_.source)"
    $senderdomain = $_.sender -replace "[^@]+@",""
    $line = $_
        "receive-smtp" {
            if(!($mailboxes.($line.recipients[0]))){$mailboxes.($line.recipients[0]) = @{}}
            $mailboxes.($line.recipients[0]).ReceivedFromExternal += 1
        "send-smtp" {
            if(!($mailboxes.($line.sender))){$mailboxes.($line.sender) = @{}}
            $mailboxes.($line.sender).SentToExternal += 1
        "deliver-storedriver" {
            if($domains -contains $senderdomain){
                if(!($mailboxes.($line.sender))){$mailboxes.($line.sender) = @{}}
                $mailboxes.($line.sender).SentToInternal += 1            
                $line.recipients | %{
                    if(!($mailboxes.$_)){$mailboxes.$_ = @{}}
                    $mailboxes.$_.ReceivedFromInternal += 1
$mailboxes.keys | %{
    New-Object -TypeName psobject -Property @{
        mailbox = $_
        ReceivedFromExternal = $mailboxes.$_.ReceivedFromExternal
        SentToExternal = $mailboxes.$_.SentToExternal
        SentToInternal = $mailboxes.$_.SentToInternal 
        ReceivedFromInternal = $mailboxes.$_.ReceivedFromInternal 
} | ft mailbox, ReceivedFromExternal, ReceivedFromInternal, SentToExternal, ReceivedFromInternal

Open in new window


Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
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…

760 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

19 Experts available now in Live!

Get 1:1 Help Now