Reputation: 309
Hi when I run the command: Get-XASession -Full -ServerName myserver01 | select SessionId,SessionName,AccountName,ServerName,LogOnTime,DisconnectTime,State,ConnectTime,BrowserNam | ft -auto
I get among other things other things ConnectTime in this format: 9/1/2014 3:56:17 AM
When I export this into to a csv and import it to Excel I need to do some manual steps to separate columns like this. Is there an easy easy to replace space in this variable(?) with a comma?
Or if there is any xenapp powershell gurus who see this there might even be a command that gives you the date/time in a better format.
//Fredrik Thanks
Upvotes: 2
Views: 17151
Reputation: 2282
Try this:
Get-XASession -Full -ServerName myserver01 | select SessionId,SessionName,AccountName,ServerName,LogOnTime,DisconnectTime,State,@{n='ConnectTime';e={$_.connectTime -replace ' ',','}},BrowserNam
Upvotes: 0
Reputation: 14755
Maybe this is something you can use:
$Date = Get-Date
$ModifiedDate = $Date -replace(" ",",")
Write-Host "ModifiedDate contains: $ModifiedDate"
You can also export with another Delimiter
like a semicolon:
$Stuff | Export-Csv -Path 'C:\Test.csv' -Delimiter ';' -NoTypeInformation
Upvotes: 3