Good morning everyone,
Does anyone know how to pull a report of all ActiveSync users from exchange 2016 using PowerShell and exported to CSV?
Good morning everyone,
Does anyone know how to pull a report of all ActiveSync users from exchange 2016 using PowerShell and exported to CSV?
M.K.,
Great question. Take a look at the script below, as it should take care of what you are looking to do.
Please remember that you need the appropriate permissions to run the script successfully.
=================================================================================
$EASDevices = ""
$AllEASDevices = @()
$EASDevices = ""| select 'User','PrimarySMTPAddress','DeviceType','DeviceModel','DeviceOS', 'LastSyncAttemptTime','LastSuccessSync'
$EasMailboxes = Get-Mailbox -ResultSize unlimited
foreach ($EASUser in $EasMailboxes) {
$EASDevices.user = $EASUser.displayname
$EASDevices.PrimarySMTPAddress = $EASUser.PrimarySMTPAddress.tostring()
foreach ($EASUserDevices in Get-ActiveSyncDeviceStatistics -Mailbox $EasUser.alias) {
$EASDeviceStatistics = $EASUserDevices | Get-ActiveSyncDeviceStatistics
$EASDevices.devicetype = $EASUserDevices.devicetype
$EASDevices.devicemodel = $EASUserDevices.devicemodel
$EASDevices.deviceos = $EASUserDevices.deviceos
$EASDevices.lastsyncattempttime = $EASDeviceStatistics.lastsyncattempttime
$EASDevices.lastsuccesssync = $EASDeviceStatistics.lastsuccesssync
$AllEASDevices += $EASDevices | select user,primarysmtpaddress,devicetype,devicemodel,deviceos,lastsyncattempttime,lastsuccesssync
}
}
$AllEASDevices = $AllEASDevices | Sort LastSuccessSync -Descending
$AllEASDevices
$AllEASDevices | Export-Csv c:\scripts\activeSyncReport.csv -nti
=================================================================================
Good Luck !!!
Cheers,
Adam
Thank you so much, Adam.
M.K,
No problem. If you have any issues, or any other questions, please post as needed. Or, if you prefer, my direct e-mail is: adam@itpro.tv
Cheers,
Adam