How to remove stale activesync mobile device partnerships from Exchange 2007
#Display the current mobile activesync devicesGet-Mailbox | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | Sort-Object DeviceType | ft Identity, Devicetype, DeviceUserAgent
#Find all of your users who have ActiveSync Partnerships:
$eas = Get-CASMailbox | where { $_.HasActiveSyncDevicePartnership -eq $True }
#Find all users within the ActiveSync Partnership list that has a “LastSyncAttempttime” less than X amount of days, here we set a 30 days for a month:
$del = $eas | ForEach-Object { Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity | where { $_.LastSyncAttempttime -lt (Get-date).adddays(-30) }}
#Remove all ActiveSync Partnerships older than 30 days:
$del | ForEach-Object { Remove-ActiveSyncDevice $_.identity -Confirm:$False }
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.