Solved

powershell

Posted on 2011-03-16
2
578 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 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 = $_
    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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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 aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we show how to create an email address policy 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…
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…

734 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