Exporting mailbox info and device info from Exchange 2007

by Nov 28, 2014

I am trying to export user info and device info from exchange 2007. I can export user info or device info, however, trying to tie both together is giving me issues.  This is my first real attempt at Powershell, any advise or explanation of what I'm screwing up would be appreciated. 


$EASMailboxes = Get-CASMailbox -Filter {HasActiveSyncDevicePartnership -eq $True -and DisplayName -notlike "CAS_{*"} | Get-Mailbox

{$User = DisplayName}

$Device = Get-ActiveSyncDeviceStatistics -Mailbox $_.User| ft DeviceType, DeviceUserAgent, LastSuccessSync

$EASMailboxes + $Device | Select SamAccountName,DisplayName,PrimarySMTPAddress,DeviceType,DeviceUserAgent,LastSuccessSync | Export-CSV H:EASMailboxes.csv -NoTypeInformation