ConvertTo-Html
ConvertTo-Html generates an HTML document with a table based on an input object. The following example generates a table based on the output from Get-Process:
Get-Process | ConvertTo-Html -Property Name, Id, WorkingSet The preceding code generates a table format by default. Table is the default value for the As parameter. The As parameter also accepts a list as an argument to generate output like Format-List.
Multiple tables
ConvertTo-Html can be used to build more complex documents by making use of the Fragment parameter. The Fragment parameter generates an HTML table or list only (instead of a full document). Tables can be combined to create a larger document:
# Create the body $body = @( '<h1>Services</h1>' Get-Service | Where-Object Status -eq 'Running' | ConvertTo-Html -Property Name, DisplayName -Fragment '<h1>Processes</h1>' Get-Process | Where-Object...