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:
ConvertTo-Html [[-Property] <Object[]>] [[-Head] <String[]>] [[-Title] <String>] [[-Body] <String[]>] [-As <String>] [-CssUri <Uri>] [-InputObject <PSObject>] [-PostContent <String[]>] [-PreContent <String[]>] [<CommonParameters>] ConvertTo-Html [[-Property] <Object[]>] [-As <String>] [-Fragment] [-InputObject <PSObject>] [-PostContent <String[]>] [-PreContent <String[]>] [<CommonParameters>]
There are no required parameters. The first parameter set creates an entire HTML page. The second parameter set creates an HTML fragment.
In the first example, you will create a report about the connection state of the hosts. The ConvertTo-Html
...