# Start of Settings # Show table of centents in report? $ShowTOC = $true # Number of columns in table of contents $ToCColumns = 1 # End of Settings $StyleVersion = 1.4 # Define Chart Colours $ChartColours = @("377C2B", "0A77BA", "1D6325", "89CBE1") $ChartBackground = "FFFFFF" # Set Chart dimensions (WidthxHeight) $ChartSize = "200x200" # Header Images Add-ReportResource "Header-vCheck" ($StylePath + "\Header.jpg") -Used $true Add-ReportResource "Header-VMware" ($StylePath + "\Header-vmware.png") -Used $true # Hash table of key/value replacements if ($GUIConfig) { $StyleReplace = @{"_HEADER_" = ("'$reportHeader'"); "_SCRIPT_" = "Get-ConfigScripts"; "_CONTENT_" = "Get-ReportContentHTML"; "_CONFIGEXPORT_" = ("'
'") "_TOC_" = ("''")} } else { $StyleReplace = @{"_HEADER_" = ("'$reportHeader'"); "_CONTENT_" = "Get-ReportContentHTML"; "_CONFIGEXPORT_" = ("''") "_TOC_" = "Get-ReportTOC"} } #region Function Definitions <# Get-ReportHTML - *REQUIRED* Returns the HTML for the report #> function Get-ReportHTML { foreach ($replaceKey in $StyleReplace.Keys.GetEnumerator()) { $ReportHTML = $ReportHTML -replace $replaceKey, (Invoke-Expression $StyleReplace[$replaceKey]) } return $reportHTML } <# Get-ReportContentHTML Called to replace the content section of the HTML template #> function Get-ReportContentHTML { $ContentHTML = "" foreach ($pr in $PluginResult) { if ($pr.Details) { $ContentHTML += Get-PluginHTML $pr } } return $ContentHTML } <# Get-PluginHTML Called to populate the plugin content in the report #> function Get-PluginHTML { param ($PluginResult) $FinalHTML = $PluginHTML -replace "_TITLE_", $PluginResult.Header $FinalHTML = $FinalHTML -replace "_COMMENTS_", $PluginResult.Comments $FinalHTML = $FinalHTML -replace "_PLUGINCONTENT_", $PluginResult.Details $FinalHTML = $FinalHTML -replace "_PLUGINID_", $PluginResult.PluginID return $FinalHTML } <# Get-ReportTOC Generate table of contents #> function Get-ReportTOC { if ($ShowTOC) { $TOCHTML = "" $i = 0 foreach ($pr in ($PluginResult | Where-Object {$_.Details})) { $TOCHTML += ("" -f $pr.PluginID, $pr.Title) $i++ # We have hit the end of the line if ($i%$ToCColumns -eq 0) { $TOCHTML +="" } } # If the row is unfinished, need to pad it out with a cell if ($i%$ToCColumns -gt 0) { $TOCHTML += ("" -f ($ToCColumns-($i%$ToCColumns))) } $TOCHTML += "
{1}
 
" return $TOCHTML } } #endregion # Report HTML structure $ReportHTML = @" _HEADER_
vCheck VMware
 
_HEADER_
_TOC_
_CONTENT_ _CONFIGEXPORT_
 
vCheck v$($vCheckVersion) by Alan Renouf generated on $($ENV:Computername) on $($Date.ToLongDateString()) at $($Date.ToLongTimeString())
"@ # Structure of each Plugin $PluginHTML = @"
 
_TITLE_
_COMMENTS_
_PLUGINCONTENT_
Back To Top
"@