Generating HTML reports
CSV files are nice, but HTML files are more impressive. This section will show you how to create nice-looking HTML files from your reports. PowerShell gives you the ConvertTo-Html
cmdlet to do this. The syntax of this cmdlet is as follows.
The first parameter set creates an entire HTML page:
ConvertTo-Html [[-Property] <Object[]>] [[-Head] <String[]>] [[-Title] <String>] [[-Body] <String[]>] [-As {Table | List}] [-CssUri <Uri>] [-InputObject <PSObject>] [-PostContent <String[]>] [-PreContent <String[]>] [<CommonParameters>]
The second parameter set creates only an HTML table and omits the HTML
, HEAD
, TITLE
, and BODY
tags:
ConvertTo-Html [[-Property] <Object[]>] [-As {Table | List}] [-Fragment] [-InputObject <PSObject>] [-PostContent <String[]>] [-PreContent <String[]>] [<CommonParameters>]
There are no required parameters.
In the first example, you will create a report about the connection...