Solved

powershell

Posted on 2011-03-16
2
583 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Suggested Courses
Course of the Month4 days, 23 hours left to enroll

635 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