Tuesday, April 2, 2013

Sometimes Apple's Go Bad

Don't get me wrong i love my Apple iPhone and I will probably never change that. But with the recent bug in iOS 6.1 which basically if you respond to a recurring meeting invite you get stuck in a "loop" that causes excessive heat and battery drain on the iOS device and rapid log growth for the Exchange storage group where their mailbox is located. It gets me to wondering how they don't see these things during a proper Beta. This bug happened in our environment and we were forced to enact a throttling policy for Apple mobile devices. Once apple had released a fix for this bug in iOS 6.1.2 we needed to see what users were still on an older version on their mobile device. Using the cmdlet Get-ActiveSyncDeviceStatistics i thought i would be able to pull all of the information that we needed from our exchange server. After much trial and error i realized that this cmdlet doesn't not work in the Powershell exchange snap-in and it must be run on the exchange server itself. 


To remedy this situatuion i used the New-PSSession command like so:




$cred = Get-Credential
$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri your.exchnage.goes.here -Authentication basic -Credential $cred

Import-PSSession $s


This will connect you to your exchange instance and allow you all the commands that it has. i then wrote this script below that will dump all of the active sync devices to a .csv file in your PWD. 




$ActiveSyncDevices = @()
#this command identifies the exchnage server you are connected to
$MbxServers = Get-MailboxServer
#if we had multiple server this would cycle through them all
foreach ($server in $MbxServers)
{

  foreach ($Mailbox in Get-Mailbox –Server $server.Name -Resultsize Unlimited) 

  {
    "Processing $($Mailbox.Identity)"
#these commands output all of the device information to the CSV file            
    Get-ActiveSyncDeviceStatistics -Mailbox $Mailbox.Identity –ErrorAction SilentlyContinue | `
    Select DeviceFriendlyName, Devicetype, DeviceOS, DeviceUserAgent, LastSuccessSync | `
    ForEach-Object { $_ | Add-Member –MemberType NoteProperty -Name "MailboxIdentity" -value $Mailbox
    $ActiveSyncDevices += $_ }
  }
}
#Save the Variable that we created to MobileDevices.csv in your current working path
$ActiveSyncDevices | Export-csv ./MobileDevices.csv



I hope this helps you identify that troublesome device. 

No comments:

Post a Comment