ReportHTML 1.4.0.3, Cmdlets Usage, Help & Examples

Report created on Jun 8, 2017 07:30 PM
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. Weve 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 draft state
1.4.0.1 introduced Get-HTMLDataTable fucntion to consume HTML 5 Data tables features. Included additional java scripts and CSS styles
1.3.2.2 Added Custom footer text to Get-HTMLPageClose -FooterText 'Your text here'.
Created Functions for Heading Get-HTMLHeading, added CSS H1 to H7.
Added PowerShell Logo, usage 'PowerShell' in get-HTMLPageOpen
1.3.2.1 Updated 'Corporate' Logo and 'Alternate' logo files
1.3.2.0 Added dynamic columns function Get-HTMLColumnOpen.
Example Usage 'Get-HTMLColumnOpen -ColumnNumber 1 -ColumnCount 2'
1.3.1.1 minor fixes
1.3.1.0 Sleeps removed from module, Axis Labels added to bar chart, few logic errors corrected.
Added Get-HTMLContentTableAadvanced
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.

Creating headings Get-HTMLHeading -headerSize 1 -headingText 'This is heading 1'
Heading Tag 1
 $rpt += Get-HTMLHeading -headerSize 1 -headingText "This is heading 1" 
Heading Tag 2
 $rpt += Get-HTMLHeading -headerSize 2 -headingText "This is heading 2" 
Heading Tag 3
 $rpt += Get-HTMLHeading -headerSize 3 -headingText "This is heading 3" 
Heading Tag 4
 $rpt += Get-HTMLHeading -headerSize 4 -headingText "This is heading 4" 
Heading Tag 5
 $rpt += Get-HTMLHeading -headerSize 5 -headingText "This is heading 5" 
Heading Tag 6
 $rpt += Get-HTMLHeading -headerSize 6 -headingText "This is heading 6" 

This is heading 1

This is heading 2

This is heading 3

This is heading 4

This is heading 5
This is heading 6

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  
Custom Report Footer
 $rpt += Get-HTMLClosePage -FooterText "Enter Your Custom Text Here" 
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