Solved

Help with Powershell Cmd

Posted on 2016-09-02
5
31 Views
Last Modified: 2016-09-02
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
0
Comment
Question by:jyoung127
  • 3
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 41781741
Try this..
Get-Mailbox -ResultSize Unlimited | ForEach {
     $User = $_.DisplayName
    Get-MobileDeviceStatistics -Mailbox:$_.Identity |
    Select-Object @{label="User" ; expression={$User}},DeviceOS,lastsuccesssync   
 }

Open in new window

1
 

Author Closing Comment

by:jyoung127
ID: 41781790
awesome thank you so much  
i was so close.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 41781803
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..
0
 

Author Comment

by:jyoung127
ID: 41781844
Hey follow up is there a way to get this exported out to a file? csv
0
 
LVL 40

Expert Comment

by:Subsun
ID: 41781861
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

1

Featured Post

Why do Marketing keep bothering you?

Is your marketing department constantly asking for new email signature updates? Are they requesting a different design for every department? Do they need yet another banner added? Don’t let it get you down! There is an easy way to manage all of these requests...

Join & Write a Comment

Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create a User Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Mailb…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now