![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Newbie: manually outputting to CSV Given this simple script; $timestamp = Get-Date -Format "yyyy/MM/dd HH:mm" $computer_name = (Get-WmiObject win32_computersystem | select name).name output_header output_body($timestamp,$computer_name,"COMPUTER_NAME",$computer_name, "", "") function output_header { $label = "TIMESTAMP","SOURCE","ELEMENT","VALUE1","VALUE2","VALUE3" $csvstring = Join-String $label -Separator "~" $csvstring } function output_body([string] $ts,[string] $src,[string] $v1,[string] $v2,[string] $v3) { $line = $ts, $src, $v1, $v2, $v3 $csvstring2 = Join-String $line -Separator "~" $csvstring2 } Why does it output the body portion differently than the header portion, see below; TIMESTAMP~SOURCE~ELEMENT~VALUE1~VALUE2~VALUE3 2008/07/04 09:59 FBYC3F1 COMPUTER_NAME FBYC3F1 ~~~~ |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||||||||||||||||||||||||||
| Guest | Re: Newbie: manually outputting to CSV Hi Kurt,
arguments stored in $ts. Best regards, Tao Ma "Kurt" <kharless@xxxxxx> ??????:8a46f05d-913d-4d48-8896-78cc06b623d2@xxxxxx
| ||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Outputting variables & accepting keystrokes without pressing enter | Kari | PowerShell | 1 | 08-08-2008 10:30 AM |
| how to manually index? | Neerav | Vista General | 7 | 01-03-2008 04:11 PM |
| Combining 2 files and outputting one | Marco Shaw | PowerShell | 4 | 11-21-2006 06:44 PM |
| help. How to remove rc2 manually | hayate | PowerShell | 3 | 11-17-2006 05:16 AM |
| Outputting to file as a byte stream | Keith Hill [MVP] | PowerShell | 8 | 08-21-2006 12:25 PM |