Travis Hahn
asked on
Exchange 2010 Email Stats Script - not showing all mailboxes
I have used a script from Microsoft's Script Repository called Email Stats. It gets stats on emails received and sent. However we have noticed that it is not including all mailboxes.
I was looking for one of the great EE Experts to review the script and see if there is something that I am overlooking that would bypass some mailboxes.
I have attached the script
I was looking for one of the great EE Experts to review the script and see if there is something that I am overlooking that would bypass some mailboxes.
I have attached the script
Would you mind posting the link to the script which you are referring too?
ASKER
Sorry - I tried uploading the .ps1 file and I didnt notice that it wouldnt upload
I have attached it now
es.txt
I have attached it now
es.txt
The script collects information from the message tracking logs from the previous day. So if a recipient didn’t sent or receive mail on that day then they will not appear in report..
ASKER
I know that part but - they did recieve email - I logged in and checked
These are the code lines from the Script...
You may run get-messagetrackinglog against the user at this time frame and see the result..
$today = get-date
$rundate = $($today.adddays(-1)).toshortdatestring()
get-messagetrackinglog -Server $ht -Start "$rundate" -End "$rundate 11:59:59 PM" -resultsize unlimited
So if you run it today then it will search from 9/10/2013 to 9/10/2013 11:59:59 PM (Server time). If user have sent or receive mail with in this time frame then only it will display.. Other than that I am not seeing any possible reason..You may run get-messagetrackinglog against the user at this time frame and see the result..
ASKER
I have attached a copy of the my get-messagetrackinglog against the user RMA and you can see they got mail yesterday
emaes.PNG
emaes.PNG
What if you try..
If above output the user information.. then just run the script ad see if you get same result..
$today = get-date
$rundate = $($today.adddays(-1)).toshortdatestring()
get-messagetrackinglog -Recipients rma@domain.com -Start "$rundate" -End "$rundate 11:59:59 PM" -resultsize unlimited
If above output the user information.. then just run the script ad see if you get same result..
ASKER
I got the same result
Sorry.. I don't have any further suggestions..
ASKER
Okay - thank you. How about changing my script to give me 7 days instead of 1 day stats?
Chnage $rundate = $($today.adddays(-1)).tosh ortdatestr ing()
to $rundate = $($today.adddays(-7)).tosh ortdatestr ing()
and following line
to $rundate = $($today.adddays(-7)).tosh
and following line
get-messagetrackinglog -Server $ht -Start "$rundate" -End "$rundate 11:59:59 PM" -resultsize unlimited |
to
Get-messagetrackinglog -Server $ht -Start "$rundate" -End "$((Get-date).adddays(-1).toshortdatestring()) 11:59:59 PM" -resultsize unlimited |
ASKER
That only produced for September 5th - it went back 7 days but didn’t accumulate the data
Did you change the Get-messagetrackinglog line?
ASKER
Get-messagetrackinglog -Server $ht -Start "$rundate" -End "$((Get-date).adddays(-1).toshortdatestring()) 11:59:59 PM" -resultsize unlimited |
time_pipeline |%{
Is it still showing 24 hours data?
ASKER
Holy Crap - sorry No it is doing a weekly total - however the Date on Column A is getting set to 7 days ago, and the the File name is appending to 7 days ago.
Is there a way I can get those to change?
Is there a way I can get those to change?
To change the file name to current date..
change $outfile_date = ([datetime]$rundate).tostr ing("yyyy_ MM_dd")
to
$outfile_date = (Get-date).tostring("yyyy_ MM_dd")
change $outfile_date = ([datetime]$rundate).tostr
to
$outfile_date = (Get-date).tostring("yyyy_
however the Date on Column A is getting set to 7Which date column you referring to? can you post a screenshot?
ASKER
On the output to CSV the date is = to rundate
$obj_table = {
@"
Date = $rundate
User = $($address.split("@")[0])
Domain = $($address.split("@")[1])
Sent Total = $(0 + $total_msgsent[$address])
#Sent MB Total = $("{0:F2}" -f $($total_bytessent[$address]/1mb))
Received Total = $(0 + $msgrec[$address])
#Received MB Total = $("{0:F2}" -f $($bytesrec[$address]/1mb))
Sent Internal = $(0 + $total_msgsent_exch[$address])
#Sent Internal MB = $("{0:F2}" -f $($total_bytessent_exch[$address]/1mb))
Sent External = $(0 + $total_msgsent_smtpext[$address])
#Sent External MB = $("{0:F2}" -f $($total_bytessent_smtpext[$address]/1mb))
Received Internal = $(0 + $msgrec_exch[$address])
#Received Internal MB = $("{0:F2}" -f $($bytesrec_exch[$address]/1mb))
Received External = $(0 + $msgrec_smtpext[$address])
#Received External MB = $("{0:F2}" -f $($bytesrec_smtpext[$address]/1mb))
#Sent Unique Total = $(0 + $unique_msgsent[$address])
#Sent Unique MB Total = $("{0:F2}" -f $($unique_bytessent[$address]/1mb))
#Sent Internal Unique = $(0 + $unique_msgsent_exch[$address])
#Sent Internal Unique MB = $("{0:F2}" -f $($unique_bytessent_exch[$address]/1mb))
#Sent External Unique = $(0 + $unique_msgsent_smtpext[$address])
#Sent External Unique MB = $("{0:F2}" -f $($unique_bytessent_smtpext[$address]/1mb))
"@
}
CaptureScriptdate.PNG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am all Good - Thank you very Much
ASKER
Awesome