Hello,
Back in 2007 we had a script that would gather the devices + 365 days out of sync. I need to adapt this to 2010/2013
Output to check -
Get-CASMailbox -ResultSize unlimited -Filter{(HasActiveSyncDevicePartnership -eq $true) -AND (name -notlike "cas_*") -AND (name -notlike "DiscoverysearchMailbox*")} | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity | Where-Object {$_.LastSuccessSync -le (Get-Date).AddDays("-365")}|fl firstsynctime,lastsuccesssync,identity,deviceID,devicetype,deviceuseragent } > directory\filename.txt
Output to remove:
Get-CASMailbox -ResultSize unlimited -Filter{(HasActiveSyncDevicePartnership -eq $true) -AND (name -notlike "cas_*") -AND (name -notlike "DiscoverysearchMailbox*")} | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity | Where-Object {$_.LastSuccessSync -le (Get-Date).AddDays("-365")} | Remove-ActiveSyncDevice -confirm:$false} > directory\output.txt
Being new to shell I am having trouble updating to have this work in 2010/2013.