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.

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

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

Children
No Data