Link to home
Start Free TrialLog in
Avatar of Thom Gann
Thom GannFlag for United States of America

asked on

Remove Outdated Mobile Devices from Exchange 2007

I would like to run a command to remove all mobile devices in the Exchange Server which have not synced in > 30 days. Is there a way in shell to do this without having to enter all of the user names?
Avatar of Rajitha Chimmani
Rajitha Chimmani
Flag of United States of America image

$OldDevices = Get-ActiveSyncDevice -result unlimited | Get-ActiveSyncDeviceStatistics | where {$_.LastSuccessSync -le (Get-Date).AddDays("-30")}
$OldDevice s| foreach {Remove-ActiveSyncDevice ([string]$_.Guid) -confirm:$false}

Open in new window


Ref: https://social.technet.microsoft.com/Forums/exchange/en-US/95ca6537-0c74-4c36-b19b-ec647e733722/remove-staleold-active-sync-devices-from-all-mailboxes
ASKER CERTIFIED SOLUTION
Avatar of Jamie McKillop
Jamie McKillop
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Thom Gann

ASKER

Worked like a champ! Thank you!
@ Rajitha Chimmani - When I tried your command, I got an error, "The term 'Get-ActiveSyncDevice' is not recognized as the name of a cmdlet, function, script file, or operable program... Thank you for the help though.