Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

powershell

Posted on 2011-03-16
2
Medium Priority
?
587 Views
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

0
Comment
Question by:happyexchange
[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
2 Comments
 
LVL 12

Expert Comment

by:Julian123
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.

http://technet.microsoft.com/en-us/library/bb508856(EXCHG.65).aspx
0
 
LVL 13

Accepted Solution

by:
soostibi earned 2000 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 = $_
    switch($status){
        "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

0

Featured Post

Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

Question has a verified solution.

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

Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
To show how to create a transport rule 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 >> Rules tab.:  To cr…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

721 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