Ionut
Ionut

Reputation: 1749

ConvertTo-Html formatting

I want to put an object in a table in a html file with the property names on the left and the values on the right.

But when doing :

Get-Process| Select-Object -First 5 | Select Name,Product,Id | ConvertTo-Html | Out-File "test.html"

I get the property names on top and values on the bottom :

Name    Product         Id
armsvc  Adobe Acrobat   1528
chrome  Google Chrome   372
chrome  Google Chrome   1296
chrome  Google Chrome   1732
chrome  Google Chrome   2012

Is there any way to translate the table or I have to write each value in the table in the right order ?

Upvotes: 0

Views: 1038

Answers (1)

mjolinor
mjolinor

Reputation: 68341

Convertto-HTML has an -as parameter that lets you specify either a table format or list format. The default is Table. Change that to List.

Get-Process| Select-Object -First 5 | Select Name,Product,Id | ConvertTo-Html -As List | Out-File "test.html"

Upvotes: 2

Related Questions