Remove Broken ActiveSync Device Partnerships

A user has hit his maximum mobile device count on your Exchange server, but when you try to remove an unused device that hasn’t synced in over a year, you get this error:

ActiveSyncDevice removal fails with cannot be found.If you look at the details of the error in the wizard, you’ll notice that the ActiveSyncDevice ID includes the user’s OrganizationalUnit. If you check the user’s current OU, chances are very good that it doesn’t match the ActiveSyncDevice. This means that the user object was moved to a different OU sometime after the sync partnership was established.

Fortunately, you can still remove the device via PowerShell:

Remove-ActiveSyncDevice -ID <DeviceGuid>

You can get the device’s guid using either of these two cmdlets:

Get-ActiveSyncDevice -Mailbox <username>

Get-ActiveSyncDeviceStatistics -Mailbox <username>

The advantage of using the second cmdlet is that you can put it in a short script to remove all obsolete devices from a given mailbox.

$ObsoleteDevices = Get-ActiveSyncDeviceStatistics -mailbox Jay.Carper | ?{$_.LastSuccessSync -lt “1/1/2015” -and $_.LastSuccessSync -ne $Null}
$ObsoleteDevices | foreach {$Guid = $_.guid.ToString(); Remove-ActiveSyncDevice -id $Guid -Confirm:$False}

These two lines get a list of all devices partnered with my mailbox that haven’t synced since January 1, 2015. I included the second half of the conditional statement in case I had just added a new phone that hadn’t completed its initial sync yet. In the second line, I take the guid from each of the obsolete devices, convert it to a string variable, and use that variable to remove the devices from the mailbox.

If you include “-Confirm:$False” be careful. Check the contents of $ObsoleteDevices first.

Leave a Reply

Your email address will not be published. Required fields are marked *