Solved

Removing ActiveSync devices from specific servers

Posted on 2014-10-24
3
243 Views
Last Modified: 2014-10-29
I have 3 exchange server in my environment and I'd like to remove old active sync partnerships (older than last sync 90 days) from each server individually.

Is there a way to run this command on a specific server?

Get-ActiveSyncDevice -ResultSize unlimited | Get-ActiveSyncDeviceStatistics | where {$_.LastSyncAttemptTime -lt (get-date).adddays(-90)} | foreach-object {Remove-ActiveSyncDevice ([string]$_.Guid) -confirm:$false}
0
Comment
Question by:toby_amsterdam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:tshearon
ID: 40401901
Activesync device partnerships are partnered to user account, not servers. And yes you can remove them with powershell.
0
 
LVL 12

Accepted Solution

by:
SreRaj earned 500 total points
ID: 40401903
Hi,

Please try the following.


$Mailboxes = Get-CASMailbox -Filter {hasactivesyncdevicepartnership -eq $true} -resultsize unlimited | Get-Mailbox | where{$_.servername -eq "MailboxServerName"}
ForEach($Mailbox in $Mailboxes){Get-ActiveSyncDeviceStatistics -Mailbox $Mailbox.Identity | where {$_.LastSyncAttemptTime -lt (get-date).adddays(-90)} | Remove-ActiveSyncDevice}
0
 

Author Comment

by:toby_amsterdam
ID: 40406606
Can I also use this to export the results before deleting?

$Mailboxes = Get-CASMailbox -Filter {hasactivesyncdevicepartnership -eq $true} -resultsize unlimited | Get-Mailbox | where{$_.servername -eq "MailboxServerName"}
ForEach($Mailbox in $Mailboxes){Get-ActiveSyncDeviceStatistics -Mailbox $Mailbox.Identity | where {$_.LastSyncAttemptTime -lt (get-date).adddays(-90)} | Export-CSV c:\activesync.csv}
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The new Gmail Phishing Scam going around is surprising even the savviest of users with its sophisticated techniques.
As cyber crime continues to grow in both numbers and sophistication, a troubling trend of optimization has emerged over the last year.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question