0

Hi just want to ask if it's possible that in PSCustomObject, I'll be having a duplicate array? Because I have to put a "|" but if did it twice, it won't accept unless I put a "space" on another "|" which is "| ".

$customtable += [PSCustomObject]@{'A'=$a; '|'=$lt1;'B'=$b;'| '=$lt2}

Also, is it possible that the presentation of data is like in Excel? No spaces, just one column header name then the rest would be just the value as I append the output. Currently I have this one:

http://i59.tinypic.com/f1fwo3.jpg

What I want is it will display like this one:

http://i59.tinypic.com/2959sab.jpg

No space. It will continuously log like a real-time even though it was deleted from different time.

BartekB
  • 8,492
  • 32
  • 33

1 Answers1

0

If all you want is nice presentation, than creating custom objects (with properties like "|") is probably overkill. Instead, try to use formatting subsystem:

# Header...
'{0,-10}| {1,-10}| {2}' -f 'DELETED', 'MODIFIED', 'PATH'
# Vertical line...
'-' * 80

$File = Get-Item C:\Windows\WindowsUpdate.log

'{0,-10:yyyyMMdd}| {1,-10:yyyyMMdd}| {2}' -f (Get-Date), $File.LastWriteTime, $File.Name

Obviously, I only assume where "deleted" and "modified" values came from. You would use first two lines once, and last one for any file that you (?) delete. To read more about '{0,#:format}' -f $Variable syntax, you may want to go to Wiki article about it.

BartekB
  • 8,492
  • 32
  • 33