Hi
I have the below script that works fine giving me what I need. However, I would like to add attributes like EmplyeeID, office, samAccountName we have in AD to the columns. However, the script returns every user, not only the ones with "$_.LastSuccesssync -ne $null". And also, if a user has two devices, the some of the information like lastsync time is blank.
$ExServers = Get-ExchangeServer servername $Mbx = $ExServers | get-mailbox | where {$_.Name -notlike '*CAS_*'} $Mbx | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | where-object {$_.LastSuccesssync -ne $null} | Select-Object DeviceType,@{Name="FirstSyncTime";expression={$_.FirstSyncTime}},DeviceID | export-csv -NoTypeInformation c:\export\export.csv
What I tried:
$ExServers = Get-ExchangeServer servername $Mbx = $ExServers | get-mailbox | where {$_.Name -notlike '*CAS_*'} $Mbx | ForEach { Get-ActiveSyncDeviceStatistics -Mailbox:$_.identity | where-object {$_.LastSuccesssync -ne $null} ; get-qaduser $_.name -includedproperties EmployeeID} | Select Samaccountname,DeviceType,@{Name="LastSuccesssync";expression={$_.LastSuccesssync}},@{Name="FirstSyncTime";expression={$_.FirstSyncTime}},DeviceID,employeeID,office | export-csv -NoTypeInformation c:\export\export.csv |