Solved

Help with Powershell Cmd

Posted on 2016-09-02
5
36 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we show how to create a Shared 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 >> Sha…
In this video we show how to create an Accepted Domain 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 Mail Flow >> Ac…

751 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