Script to Remove old Device Activesync Partnerships RRS feed

  • Question

  • I would like to find a way to purge old device partnerships from exchange if the device hasn't synced in > 30 days.   I found this thread with what looks like a nice script but I get the same error about "Pipelines cannot be executed concurrently" that one of the posters gets.   There was never a reply to the problem:


    Can anyone come up with a similar script or fix the one listed?

    Tuesday, July 3, 2012 3:31 PM


All replies

  • If you have Exchange 2010, you can use get-activesyncdevice

    $DevicesToRemove = Get-ActiveSyncDevice -result unlimited | Get-ActiveSyncDeviceStatistics | where {$_.LastSuccessSync -le (Get-Date).AddDays("-30")}
    $DevicesToRemove | remove-activesyncdevice

    Mike Crowley | MVP
    My Blog -- Planet Technologies

    Tuesday, July 3, 2012 3:51 PM
  • Any particular reason for -result 10? or was that left in there for testing?

    Tuesday, July 3, 2012 3:55 PM
  • You're quick!  I left it in for testing, but then changed it to unlimited.  it's fixed now.

    Mike Crowley | MVP
    My Blog -- Planet Technologies

    Tuesday, July 3, 2012 3:56 PM
  • It has come to my attention that this is no longer working as expected.   When I run the commands, some users return with an error (Name and OU Structure Removed To Protect Environment):

    Couldn't find  <OU STRUCTURE/NAME REMOVED HERE> as a recipient.
        + CategoryInfo          : InvalidArgument: (:) [Remove-ActiveSyncDevice], RecipientNotFoundException
        + FullyQualifiedErrorId : 348B694C,Microsoft.Exchange.Management.Tasks.RemoveMobileDevice

    Monday, November 26, 2012 5:38 PM
    • Marked as answer by Mike Crowley Thursday, January 10, 2013 7:39 PM
    • Edited by Mike Crowley Friday, March 8, 2013 6:12 PM
    Thursday, January 10, 2013 7:36 PM