?
Solved

Removing ActiveSync devices from specific servers

Posted on 2014-10-24
3
Medium Priority
?
247 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 2000 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
To show how to create a transport rule 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 Mail Flow >> Rules tab.:  To cr…
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…
Suggested Courses

770 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