Answered by:
Script to Remove old Device Activesync Partnerships

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:
http://www.powershellcommunity.org/Forums/tabid/54/aft/6425/Default.aspx
Can anyone come up with a similar script or fix the one listed?
Tuesday, July 3, 2012 3:31 PM
Answers
-
See answer here: http://social.technet.microsoft.com/Forums/hi-IN/exchange2010/thread/95ca6537-0c74-4c36-b19b-ec647e733722
Mike Crowley | MVP
My Blog -- Planet Technologies- 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
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- Edited by Mike Crowley Tuesday, July 3, 2012 3:52 PM
- Proposed as answer by Mike Crowley Tuesday, July 3, 2012 3:56 PM
- Marked as answer by John Owens - Maximus Tuesday, July 3, 2012 3:57 PM
- Unmarked as answer by Mike Crowley Thursday, January 10, 2013 7:39 PM
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 TechnologiesTuesday, 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.RemoveMobileDeviceMonday, November 26, 2012 5:38 PM -
See answer here: http://social.technet.microsoft.com/Forums/hi-IN/exchange2010/thread/95ca6537-0c74-4c36-b19b-ec647e733722
Mike Crowley | MVP
My Blog -- Planet Technologies- 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