?
Solved

powershell output csv format

Posted on 2014-01-15
4
Medium Priority
?
973 Views
Last Modified: 2014-01-15
Hi guys

I can use
Get-Mailbox -resultsize unlimited | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | ft identity, lastsuccesssync, Devicetype
to get them in powershell. or output it to a csv file.

but the format is not what i want. the csv only has one column.

does any one know a way to output the result into a csv file with three columns?

thanks a lot.

SYH
0
Comment
Question by:BLarry9
  • 2
4 Comments
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39784083
Yes all you need to do is the following...

Get-Mailbox -resultsize unlimited | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | select identity, lastsuccesssync, DeviceType | out-file c:\filename.csv

Open in new window


Will.
0
 

Author Comment

by:BLarry9
ID: 39784090
nope, still in one column.
0
 
LVL 41

Accepted Solution

by:
footech earned 2000 total points
ID: 39784101
Use the Export-CSV cmdlet.
Get-Mailbox -resultsize unlimited | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | Select identity, lastsuccesssync, Devicetype | Export-CSV somefile.csv -notype

Open in new window

0
 

Author Comment

by:BLarry9
ID: 39784116
super. thanks.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

850 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