There was a lot of feedback from people who wanted extra items and fields added in so I edited the original script. It will now also include the users Primary SMTP Address, LastSyncAttemptTime, and LastSyncSuccessTime. Also edited it for environments with over a thousand mailboxes. Below is the updated script code:
The new output will look like this:
Ever had the need to get a nice report of all active sync devices in your Exchange organization? Well then I have the script for you!
This script will get through all active sync devices, and match them up with their respective owners. It will also output the Device Type, Device Model, and most importantly the Device OS.
Why is this important? As some of you remember shortly back, there was an issue with Apple iOS devices causing excessive logging on Exchange Mailbox servers. As part of the way to fix that you could block or quarantine those devices. You most likely want to be able to see who you are blocking though, so you you know who your going to annoy and warn them preemptively.
The script requires 4 parameters to run, and should be run from an Exchange Management Shell:
- SMTPServer = SMTP server as the report will send you a copy of the report
- SMTPFrom = The FROM address of the email
- SMTPTo = The recipient of the email
- ExportPath = The folder location where you want the CSV export of the report.
|Get-ActiveSyncReport.ps1 –exportpath C:\Reports –smtpserver relay.port25guy.com –smtpfrom firstname.lastname@example.org –smtpto email@example.com|
After running that, if we check the C:\reports folder we should have a nice CSV export:
And a nice email report in your inbox:
You can download the script from the link below, just rename the file to extension .ps1
Here is the ***UPDATED** script block as well:
### BEGINNING OF SCRIPT
$messageSubject = “ActiveSync Device Report”
$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
#### Get Mailbox
$EASDevices = “”
$EASDevices = “”| select ‘User’,’PrimarySMTPAddress’,’DeviceType’,’DeviceModel’,’DeviceOS’, ‘LastSyncAttemptTime’,’LastSuccessSync’
$message.Body = $AllEasDevices | ConvertTo-Html -Head $style
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
##END OF SCRIPT
Also, special thanks to Paul Cunningham at http://exchangeserverpro.com. He wrote the HTML formatting section in the script that makes this look nice and pretty, versus my junky plain text (http://exchangeserverpro.com/powershell-html-email-formatting). If you haven’t check out Paul’s site you should, he has great information on there.
Hope you find the script helpful!