I have come up with a script that should remove Active Syncs from user accounts that are disabled, but i would also like to export the display name and alias to a csv. I don't know if my export-csv is in the right spot to get all of the accounts. Below is the script:
Powershell
#Variables$FilePath="C:\Scripts\ActiveSync\removed-eas.csv"$OuDomain=""$StaleDevices=Get-Mailbox-resultsizeunlimited-OrganizationalUnit$OuDomain|ForEach{Get-ActiveSyncDeviceStatistics-Mailbox:$_.Identity}`|where{$_.ExchangeUserAccountControl-match'AccountDisabled'}|select-expandIdentityforeach($devicein$StaleDevices){Remove-ActiveSyncDevice-Identity$device-confirm:$true}|Select-ObjectDisplayName,Alias|Export-Csv$FilePath-NoTypeInformation