Solved

EXCHANGE 2007, SCRIPTS

Posted on 2016-09-19
67
111 Views
Last Modified: 2017-06-06
I need to run a script on EMS  to find number of email received and send by a particular group OR USERS
0
Comment
Question by:pramod1
[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
  • 41
  • 25
67 Comments
 
LVL 43

Expert Comment

by:Amit
ID: 41805157
You can use messaging tracking logs. Parse them to retrieve the data. Make sure you have tracking logs available. Normally it is set to replace after 14 days. You can use EM tool or EMS both. Below is a script from MS.
https://gallery.technet.microsoft.com/scriptcenter/bb94b422-eb9e-4c53-a454-f7da6ddfb5d6
0
 

Author Comment

by:pramod1
ID: 41805177
confused, how to retrieve number of email send and received from 250 users
0
 

Author Comment

by:pramod1
ID: 41805205
can you provide some simple solution, I need to retrieve email sent and received by 250 users belonging to 1 group
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 49

Expert Comment

by:Akhater
ID: 41805251
This should give you a count of email sent by each user in the group as requested
$Users = Get-DistributionGroupMember GroupName

foreach($user in $Users){
	Get-MessageTrackingLog  -ResultSize unlimited -Sender $user.PrimarySmtpAddress.ToString() -EventId Receive | where {$_.Source -eq "StoreDriver"} | Group-Object -Property sender | ft name,count
}		

Open in new window

0
 
LVL 49

Expert Comment

by:Akhater
ID: 41805282
wait ignore the above it is too slow

this should give the same but faster

$msgs = Get-MessageTrackingLog -ResultSize Unlimited -EventId Receive 
$out = @()

foreach($user in $users){

	$out += $msgs | ? {$_.sender -like $user.PrimarySmtpAddress  -and $_.source -eq "STOREDRIVER"} 

}

$out | Group-Object -Property sender | ft name,count

Open in new window

0
 

Author Comment

by:pramod1
ID: 41805447
we have group called storetablets which is universal distribution group and all users are inside there

can you incorporate that in script. will really help me
0
 

Author Comment

by:pramod1
ID: 41805456
how can I pipe them in txt I need to send
0
 
LVL 49

Accepted Solution

by:
Akhater earned 500 total points
ID: 41805488
$users = Get-DistributionGroupMember StoreTablets
$msgs = Get-MessageTrackingLog -ResultSize Unlimited -EventId Receive
$out = @()

foreach($user in $users){

      $out += $msgs | ? {$_.sender -like $user.PrimarySmtpAddress  -and $_.source -eq "STOREDRIVER"}

}

$out | Group-Object -Property sender | select name,count   | export-csv c:\list.csv
0
 

Author Comment

by:pramod1
ID: 41805490
-eq "STOREDRIVER"}  here I have to write " -eq "storetablet"}
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41805493
No I just updated the script for you
0
 

Author Comment

by:pramod1
ID: 41805497
so where it will members of storetablet group as all 250 users are in that group
0
 

Author Comment

by:pramod1
ID: 41805499
ok you wrote above , my bad
0
 

Author Comment

by:pramod1
ID: 41806418
Hi Akhater,

I am attaching screen shot, it is sitting like this for 10 mins, is it working , just to confirm
Capture1.JPG
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806536
You need to press enter to execute the last command and then check if the file was created
0
 

Author Comment

by:pramod1
ID: 41806645
file name got created with 0 bytes
0
 

Author Comment

by:pramod1
ID: 41806648
what have I missed
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806656
run the below and give me the output

$users = Get-DistributionGroupMember StoreTablets
$msgs = Get-MessageTrackingLog -ResultSize Unlimited -EventId Receive

$users.count
$msgs.count
0
 

Author Comment

by:pramod1
ID: 41806738
$users 497
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806743
what about $msgs
0
 

Author Comment

by:pramod1
ID: 41806757
it is still waiting
0
 

Author Comment

by:pramod1
ID: 41806763
what is your email address, I am logged into webex
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806767
I am sorry pramod like I told you in the message I can only connect thru the live connect of Experts-Exchange
0
 

Author Comment

by:pramod1
ID: 41806769
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806773
pramod1 this is a public forum please do not post such links it is not safe for you
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806785
any news about $msgs.count ?
0
 

Author Comment

by:pramod1
ID: 41806787
no it is still stuck
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806794
when you say stuck do you have a progress bar or anything ?
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806827
$msgs = Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -EventId Receive

$msgs.count
 

ok please try the above now and give me the output
0
 

Author Comment

by:pramod1
ID: 41806841
yes it is creating list.csv but with 0 bytes
0
 

Author Comment

by:pramod1
ID: 41806846
I am running on mailbox server should I run on CAS servr
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806848
you should run it on the transport server

anyway the command i gave you in my last post should work no matter where you run it please give it a try

also go to http://micc.mitel.com/kb/KnowledgebaseArticle51059.aspx and make sure message tracking log is enabled
0
 

Author Comment

by:pramod1
ID: 41806851
it seems working on cas server
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806873
Don't forget to press enter
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806874
Don't forget to press enter
0
 

Author Comment

by:pramod1
ID: 41806877
I did
0
 

Author Comment

by:pramod1
ID: 41806878
still showing progress bar
0
 

Author Comment

by:pramod1
ID: 41806880
I am running on exchange 2007
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806886
Progress bar is good wait for it to finish
0
 

Author Comment

by:pramod1
ID: 41806900
can you have a close look
Capture.JPG
0
 

Author Comment

by:pramod1
ID: 41806902
there are 2 symabols showing above progress bar
0
 

Author Comment

by:pramod1
ID: 41806907
$users = Get-DistributionGroupMember StoreTablets
 $msgs = Get-MessageTrackingLog -ResultSize Unlimited -EventId Receive
 $out = @()

 foreach($user in $users){

       $out += $msgs | ? {$_.sender -like $user.PrimarySmtpAddress  -and $_.source -eq "STOREDRIVER"}

 }

 $out | Group-Object -Property sender | select name,count   | export-csv c:\list.csv
0
 

Author Comment

by:pramod1
ID: 41806911
anything I am missing
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41806913
Did it create the file?
0
 

Author Comment

by:pramod1
ID: 41807045
on hub transport server, it didn't create the file
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41807058
In the same place where you ran the script just type
$msg.count
$out

What is the output
0
 

Author Comment

by:pramod1
ID: 41807109
nothing come
Capture.JPG
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41807116
no that's a new window you closed the old one ??

Ok
open a exchange shell windows and don't close it

run

$users =  Get-DistributionGroupMember StoreTablets
$msgs = Get-TransportServer |Get-MessageTrackingLog -ResultSize Unlimited -EventId Receive 
$out = @()

foreach($user in $users){

       $out += $msgs | ? {$_.sender -like $user.PrimarySmtpAddress  -and $_.source -eq "STOREDRIVER"} 

 }

Write-host $msgs.count
Write-host $out.count

$out | Group-Object -Property sender | select name,count   | export-csv c:\list.csv

Open in new window


give me the output and again don't close this shell
0
 

Author Comment

by:pramod1
ID: 41807128
I just needed number of emails received and sent by recipients in that group
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41807136
This expert suggested creating a Gigs project.
yes I know
0
 

Author Comment

by:pramod1
ID: 41807155
it is running
Capture.JPG
0
 

Author Comment

by:pramod1
ID: 41807156
let you know shortly
0
 

Author Comment

by:pramod1
ID: 41807161
it is held up here should I press enter
Capture.JPG
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41807164
no it is still running wait for it to finish
0
 

Author Comment

by:pramod1
ID: 41807167
I pressed enter it is still waiting with progress bar
0
 

Author Comment

by:pramod1
ID: 41807175
should I do again now as I pressed enter but it still shows status same with progress bar
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41807177
no just wait till it finishes and you have a prompt
0
 

Author Comment

by:pramod1
ID: 41807182
ok I will wait
0
 

Author Comment

by:pramod1
ID: 41807207
it is still sitting there the users I am referring to in that group has domain-retail.com can we modify anything
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41807225
It shouldn't be a still running send me a screen shot
0
 

Author Comment

by:pramod1
ID: 41807228
attached
Capture.JPG
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41807239
Ok maybe it is a huge list of emails give it some more time
0
 
LVL 49

Expert Comment

by:Akhater
ID: 41807240
Ok maybe it is a huge list of emails give it some more time
0
 

Author Comment

by:pramod1
ID: 41807247
ok thanks I will let you know there are 250 users
0
 

Author Comment

by:pramod1
ID: 41807343
still showing the bar
0
 

Author Comment

by:pramod1
ID: 41807410
it is still showing bar , should I close it or leave it
0
 

Author Comment

by:pramod1
ID: 41807906
the script on the mailbox server creates the log file but empty , on CAS server script shows running for sometime but then progress bar comes up but no log file is created.

 we have resource domain set up like exchange is having disabled AD accounts and separate AD account forest, is that not causing issues
 
Exchange sits in another forest and AD account in another forest. Between both forest, we have tool like MIM, which replicates the data from primary AD forest to Exchange forest. MIM creates ID in Exchange forest as disabled.
0
 

Author Comment

by:pramod1
ID: 41809301
how can I check

number of emails flowing in and out of my organization through script

also how can I check public folders are mail enabled or not and how many
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
how to add IIS SMTP to handle application/Scanner relays into office 365.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

623 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