Link to home
Start Free TrialLog in
Avatar of epmmis
epmmis

asked on

How to output powershell in csv format

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

ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

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

ASKER

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