Link to home
Start Free TrialLog in
Avatar of jyoung127

asked on

Help with Powershell Cmd

Need Help with Getting an overview of all ActiveSync devices in the Exchange-organization in a Comma Separated Format.

I have been working with this but cant get the username format to run correctly

Get-Mailbox -ResultSize Unlimited | ForEach {
   #$user = $mailbox.DisplayName
   $deviceinfo.User = $mailbox.DisplayName
    Get-MobileDeviceStatistics -Mailbox:$_.Identity |
   Select-Object @{label="User" ; expression={$deviceinfo.User}},DeviceOS, lastsuccesssync

It just repeats the same user.

Thanks in advance
Avatar of SubSun
Flag of India image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jyoung127


awesome thank you so much  
i was so close.
Yes.. $mailbox was not defined in the current script, so that values was picked possibly from a previous code which ran on the PS console. I changes it to get values form PS pipeline to fix it..
Hey follow up is there a way to get this exported out to a file? csv
Use Export-csv ..
Get-Mailbox -ResultSize Unlimited | ForEach {
     $User = $_.DisplayName
    Get-MobileDeviceStatistics -Mailbox:$_.Identity |
    Select-Object @{label="User" ; expression={$User}},DeviceOS,lastsuccesssync   
 }| Export-csv C:\temp\report.csv -nti

Open in new window