Solved

How to output powershell in csv format

Posted on 2015-01-15
2
231 Views
Last Modified: 2015-01-15
This script is used to return a list of users logged onto citrix servers.  Its output is in a text, space deliminated format.
How can the script be modified so it outputs in a comma seperated value (csv)?  This would make it easier to open in Excel.

add-pssnapin citrix* -erroraction silentlycontinue
#write-host (get-date) 

Get-xasession -farm | select-object -property @{N="Date Time";E={Get-date}},AccountName,ServerName,ClientName,BrowserName | Format-Table  -HideTableHeaders  -autosize



#get-xasession -farm | get-member 
#write-host (get-date) $env:computername
#write-host (get-date) $env:computername
#get-xasession -farm | select-object -property AccountName,ServerName,ClientName,BrowserName,ClientIPV4,SessionName | ft  -HideTableHeaders
#Get-xasession -farm | select-object -property @{N="Date Time";E={Get-date}},AccountName,ServerName,ClientName,BrowserName,ClientIPV4,SessionName | Format-Table  -HideTableHeaders  -autosize

Open in new window

0
Comment
Question by:epmmis
[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
2 Comments
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40551923
In general and particular, you replace Format-* cmdlets by Export-CSV -NoType file.csv
0
 

Author Closing Comment

by:epmmis
ID: 40552363
Spot on answer.

Did learn that powershell 2 can not append to a .csv file.  Of course powershell is the installed version.  
Used a simple dos copy command to append the files

thanks
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This article explains how to install and use the NTBackup utility that comes with Windows Server.
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

726 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