Author Posts

November 2, 2014 at 2:20 pm

I'm learning PS. If I execute:

Dir | Format-Table * | Out-Host performs as I expected. I get a big table with a lot of columns about files, which is what I expect.

And if I use:

Dir | Sort-Object Length | Select-Object Name, Length | ConvertTo-Html | Out-File report.htm

I get a table in HTM format as expected also.

BUT if I use:

Dir | Format-Table * | ConvertTo-Html | Out-File report.htm

I get a weird HTM file full of ClassIDs and seriously bad html table and none of the info I expected.

Any idea why?

November 2, 2014 at 2:59 pm

See "The Big Book of PowerShell Gotchas." Common question. Format commands can't be piped to many others.