I have a PowerShell script which generates some PC inventory data. The script outputs an object like
Incident : INC123456Hostname : PC103399Operating System : Microsoft Windows 10 EnterpriseSystem Manufacuturer : LENOVOSystem Model : 20HR000FUSCottage Asset Tag : 103399Serial Number : Wired MAC Address : Wi-Fi MAC Address : Location : A0:88:69:FA:AC:F8Department : RadiologyDate Deployed : 03/05/2018
The Convertto-HTML command converts the data to a table with column one data as a header row and column to as row data. I would like to have the HTML table formatted in the same way as in output object. Is this even possible? Any help is appreiciated.
That must be easy if you look at the example here https://www.w3.org/TR/html401/struct/tables.html#h-11.4.3 or ask do my science homework to do it for you.
Have you looked at the built-in online help file for this cmdlet?
There several options to help you with formatting the created file.
# get function / cmdlet details
(Get-Command -Name ConvertTo-Html).Parameters
Get-help -Name ConvertTo-Html -Examples
Get-help -Name ConvertTo-Html -Full
Get-help -Name ConvertTo-Html -Online
The standard text / file parsers will do only what they are designed to do. If you want the output to look different, then you have to directly control that.
Create Hardware Inventory HTML Reports Using PowerShell.The basic idea of this script to find the Part Number and Serial Number of installed hardware. For example serial Number of Hard disk, Physical ram , Cd drives. In my environment i want that this script should reside on Users Laptop/desktop. and create a batch file to call thishttps://gallery.technet.microsoft.com/scriptcenter/Hardware-Inventory-Using-fe6611e0
If you do not assign a header to a table file, it will take the first line as the header, by design.