This post is also available in: Polish
Few days ago, we wrote about problems with Apple mobile devices updated to iOS6, and also we wrote how to check mobile devices connected to mailboxes in Exchange 2010.
Below you can find link to last post:
Exchange 2010 ActiveSync Devices list
Now because lot of people have problems with mobile devices with iOS6 connected to mailboxes on Exchange 2010, we want to show you how you can get check how many mobile devices are connected to mailboxes in your Exchange 2010 environment.
To get list of all mobile devices connected to mailbox JSmith use below command:
Get-ActiveSyncDeviceStatistics -Mailbox JSmith | ft DeviceType, DeviceUserAgent, LastSuccessSync
Now we need to get all mailboxes from MB01 server and get list of all mobile devices which were used to connect to those mailboxes.
To do this we need to use both command: Get-Mailbox and Get-ActiveSyncDeviceStatistics
If we want to get all mailboxes from MB01 server:
$MBXs = Get-Mailbox -server MB01 -RecipientTypeDetails UserMailbox –ResultSize Unlimited -Filter {HiddenFromAddressListsEnabled -eq $false}
Now we need to check mobile devices:
$Devices = $MBXs | %{Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity}
As a result we get list of all mobile devices in variable $Devices
We can do lot of things with this list, but this list also include mobile devices used long time ago.
For better result we need to select only devices connected to mailboxes during last 30 days.
To get this list we need to use LastSucessSync option like below:
$Devices = $MBXs | %{Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity} | ?{$_.LastSuccessSync -gt (Get-Date).AddDays(-30)}
Now we have list of mobile devices connected to mailboxes on Exchange 2010 for the last 30 days.
To check how many Apple devices we have, we need to use DeviceType and write IP*:
$Devices | ? {$_.DeviceType -like "IP*"} | Group-Object -Property DeviceType -NoElement
To get list of Apple devices software/hardware version we need to use DeviceUserAgent:
$Devices | ? {$_.DeviceType -like "IP*"} | Group-Object -Property DeviceUserAgent -NoElement
If we want we can inform ours users with Apple devices to not update theirs devices to iOS6. We can get SMTPAddresses of Apple devices users and send them email with information.
We can use script like below:
$SMTPServer = "smtp.domain.com" $SMTPPort = 25 $Subject = "Don't update your Apple device to iOS6" $Body = "Don't update your mobile devices OS to iOS6 if it's not necessary. Contact with your IT Support" $From = "mail@domain.com" $MBXs = Get-Mailbox -server MB01 -RecipientTypeDetails UserMailbox –ResultSize Unlimited -Filter {HiddenFromAddressListsEnabled -eq $false} $Devices = $MBXs | %{Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity -and $_.DeviceType -like "IP*"} | ?{$_.LastSuccessSync -gt (Get-Date).AddDays(-30)} $Addresses = $Devices | %{$_.Identity.SMTPAddress} | Get-Unique $Addresses | % { $Mail = (New-Object System.Net.Mail.smtpclient($SMTPserver, $SMTPport)) $Mail.Send($From, $_, $Subject, $Body) $Mail = $null }