Formatting Table in HTML Format

I have a PowerShell script which generates some PC inventory data. The script outputs an object like

Incident : INC123456
Hostname : PC103399
Operating System : Microsoft Windows 10 Enterprise
System Manufacuturer : LENOVO
System Model : 20HR000FUS
Cottage Asset Tag : 103399
Serial Number : 
Wired MAC Address :
Wi-Fi MAC Address : 
Location : A0:88:69:FA:AC:F8
Department : Radiology
Date 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.

  • 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.

    Example:

    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 this
    https://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.

  • Our field of activity does not stand still and always provides opportunities for experimentation. Another plus is the ability to avoid repetitive work by automating monotonous processes. Your work will never go to waste, so if you did something well, you can use a similar approach several times. I want to say this to those who are afraid to start learning a program for making drawings. Guys, even if you need help with your drawing homework, it's okay. You can always find a service to help you. Here is the website - https://kompaswork.ru for this service.