ReportHTML 1.3.0.7, Cmdlets Usage, Help & Examples

Report created on Feb 18, 2017 10:41 AM

Why we wrote this PowerShell is an amazing tool for gathering, collecting, slicing, grouping, filtering and collating data. However, trying to show that information or several sets of it on one report is not as easy. A few years we ago built our own solution, we created a set of HTML reporting functions. I have been using these functions for years to help myself, my team and customers to deliver Powershell data to people that just need the details and not a CSV file or a code snippet. We’ve now decided to make these available to the rest of you.
Original Credits This code was originally borrowed from Alan Renouf for a vSphere healthcheck report by Andrew Storrs and myself for a more dynamic reporting style, being able to create reports on the fly with minimal effort.
Recent Credits Jennifier Han, Giovanni Fleres, Chris Speers, Keith Ellis, Blake and Moep
Running Reports These reports, once built can be scheduled to run, dropped on a file share emailed or saved to an Azure Storage Blob.
This Help Report Will walk through several examples of how to use the functions to generate different types of reports.
Beta Help File Please note this help is in a first draft
1.3.0.7 Added This Change Log
1.3.0.6 Added Totals to get-HTMLContentTable and associated help content
1.3.0.5 another fix to save-HTMLReport so it can handle a null reportpath. Moved Html Help file logic to a nested psm1 file.
In addition to Creating ReportHTMLHelpers to start building more reports this module
was updated in conjunction with publishing Run-ReportAzureRBAC
1.3.0.4 Minor Fixes, Major addition a Help Report. run Get-HTMLReportHelp
1.3.0.1 Changes to allow for more flexible customization, use Chart JS for charting, working in Azure Automation and
now support HTML5 Tabs
1.3.0.0 Awesome changes here for flexibility with CSS, Logos, Chart creation and more. Hopefully there will be less
major changes from here once legacy cmdlets are removed. Feedback always welcome
1.2.0.3 Changes to add functionality for Custom CSS files and changed export to be HTML file type. The CSS and
Javascript files are now present in the module directory allowing for ease of manipulation
and customization. Get-HTMLOpen and Get-HTMLClose still present in module but
can be replaced with Get-HTMLOpenPage and Get-HTMLClosePage.
1.2.0.1 Changes (non Breaking) to add functionality for Custom CSS files and changed export to be HTML file type.
Get-HTMLOpen and Get-HTMLClose still present in module but can be replaced with
Get-HTMLOpenPage and Get-HTMLClosePage.
10.0.0.15 Thanks to Moep for fix to table row color with default values.
1.0.0.14 Added Bar chart function and -testchart switch
1.0.0.12 fixed HTML Close working on charting options
1.0.0.11 fixed HTML Close.

Functions Each function return HTML code, the parameters you send in will be return with HTML code.
Building an Array To build a report create an array object and add parts of your report together.
Eg, create an array variable $Rpt = @()
Next add to the array.
$RPT += get-htmlpageopen -title "Welcome"
Open / Close Although these functions help you with HTML its still HTML. HTML uses tags and everything you open you must close
Get-HTMLContentOpen -HeaderText, creates a section header. You can then add other functions and code. However you must eventually add get-HTMLContentClose.
Using Indenting is an easy way to keep track of what tag your in.
Saving Reports The Array need to be saved to a file, there are a couple of options for this.
You can save the array to a file using set-content.
$rpt | set-content -path "c:\temp\MyReport.html"
You can use the Save-HTMLReport Function. There is also a save to storage azure blob option
Building Report Code
 $rpt = @()
$rpt += Get-HTMLOpenPage -TitleText "ReportHTML" 
	$rpt += Get-HTMLContentOpen 
		$rpt += Get-HTMLContentText -Heading "Header" -Detail "Detailed Information" 
	$rpt += Get-HTMLContentClose 
$rpt += Get-HTMLClosePage  
Saving a Report - Write Array to file
 $rpt | set-content -path "c:\temp\MyReport.html"  
Set-Content -Value $rpt -path "c:\temp\MyReport.html"  
Invoke-item "c:\temp\MyReport.html" 
Saving a Report - Use the builtin function (1 Liner Options)
 Save-HTMLReport -Reportcontent $rpt -ReportPath c:\temp -ReportName "MyReport" -showreport
Save-HTMLReport -Reportcontent $rpt -ReportPath c:\temp -ReportName "MyReport.html" 
Save-HTMLReport -Reportcontent $rpt -ReportPath c:\temp -ReportName "MyReport" 
Save-HTMLReport -ShowReport 
$SavedFile = Save-HTMLReport -ShowReport  
Saving a Report - Save To Azure Storage Blob
 Save-HTMLToBlobStorage -Needs an Azure Account #More to come 
ReportHTML
ReportHTML

Report created on Feb 18, 2017 10:41 AM
Header Detailed Information

Mixed and Match You can use the following parameters in a mix and match format
-LeftLogoName These switch will load logos to the top left of the report from JPG files saved in the module directory. There are 4 image files in the module for examples 'Alternate','Blank','Sample' and 'Corporate' (this uses Get-HTMLLogos)
-RightLogoName These switch will load logos to the top of the report right from JPG files saved in the module directory. There are 4 image files in the module for examples 'Alternate','Blank','Sample' and 'Corporate' (this uses Get-HTMLLogos)
-LeftLogoString You can eith use a URL reference here, or Base 64 encoded string
-RightLogoString You can eith use a URL reference here, or Base 64 encoded string
-hidelogos Remove the header
-LogoPath Use in conjunction with LeftLogoName and RightLogo Name. Specify the File Name in the directory
Load Images from Files
 Get-HTMLOpenPage -TitleText "Example 1" -LeftLogoName Corporate -RightLogoName Alternate 
Example 1