19 December 2013

ActiveSync connection report

I wanted to get more info on our active sync devices and any errors that may occur.
So after a trip down the Micrsoft Script gallery i came across this: ActiveSyncReport.PS1

Just what i was looking for.
After adjusting some parameters, i created an email report to show me the activesync devices that had more than 1000 connections to the CAS-HUB servers from the internet from the day before.

Which looks something like this:

# Current date minus 1 day
$Date = (get-date (get-date).Adddays(-1) -Format "dd-MM-yyyy")
$LogparserExec =  "C:\Program Files (x86)\Log Parser 2.2\LogParser.exe"
$ActiveSyncOutputFolder = "D:\Temp\ASoutput"
$IISLogs = "
\\sr-xxxx\d$\IISLogs\w3svc1\","\\sr-xxxx\d$\IISLogs\w3svc1\"
$SMTPServer = "smtp.domain.lan"
$SMTPSender =
Activesync@domain.com
$SMTPRecipient = "username1
@domain.com","username2@domain.com"
$SendEmailReport = $true
$HTMLReport = $true
$MinimumHits = 1000


And finally send the email:

Send-MailMessage -To $SMTPRecipient -From $SMTPSender -SmtpServer $SMTPServer -Subject "Exchange ActiveSync Report $Date $title" -BodyAsHtml $body



I changed some parameters to functions so it is easier to generate the same report every day.
Otherwise i would have to change the date every time i wanted to generate the report.

The script itself can be found here
The full description and examples can be found here

No comments:

Post a Comment