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edgAL96+p0LffKzbTcVs5y4itJpSemfJ2F4Ftpgs5nw+lraWRzcrnMafKHIgjVWfbOk4n75iX7Mf7V9PhCh8tJvbgmZIcXGK0pM+ScWwLbjHJmy4lTV9U9gyszt0aO4WsPUrjo76Mcerto6WetoZIKWneHyOkbYfSvp47kj9w8VM+YtcOhJJGSvjq1NSbbGxi24WHBTBRsUgXHOqf/2Q== '@ #endregion #region Report Options Function New-HTMLReportOptions { [CmdletBinding(DefaultParameterSetName='NoSave')] param ( [Parameter(Mandatory=$false,ParameterSetName='NoSave')] [Parameter(Mandatory=$false,ParameterSetName='Save')] [System.Collections.Hashtable] $LogoSources, [Parameter(Mandatory=$false,ParameterSetName='NoSave')] [Parameter(Mandatory=$false,ParameterSetName='Save')] [System.Collections.Hashtable] $ColorSchemes, [Parameter(Mandatory=$false,ParameterSetName='NoSave')] [Parameter(Mandatory=$false,ParameterSetName='Save')] $CSSName = "default", [Parameter(Mandatory=$false,ParameterSetName='NoSave')] [Parameter(Mandatory=$false,ParameterSetName='Save')] [String] $CSSPath, [Parameter(Mandatory=$false,ParameterSetName='NoSave')] [Parameter(Mandatory=$false,ParameterSetName='Save')] [String] $ScriptPath, [Parameter(Mandatory=$false,ParameterSetName='NoSave')] [Parameter(Mandatory=$false,ParameterSetName='Save')] [String] $ColorSchemePath, [Parameter(Mandatory=$false,ParameterSetName='NoSave')] [Parameter(Mandatory=$false,ParameterSetName='Save')] [String] $LogoPath, [Parameter(Mandatory=$false,ParameterSetName='Save')] [String]$SaveOptionsPath, [Parameter(Mandatory=$false,ParameterSetName='NoSave')] [Parameter(Mandatory=$false,ParameterSetName='Save')] [String] $ReportPath ) if($LogoSources -eq $null) { $LogoSources = get-htmllogos -Logopath $LogoPath } if($ColorSchemes -eq $null) { $ColorSchemes=Get-HTMLColorSchemes -SchemePath $ColorSchemePath } if ($LogoSources -eq $null) { $LogoSources = Get-HTMLLogos -LogoPath $LogoPath } $ScriptHeaderContent=Get-HTMLJavaScripts -ScriptPath $ScriptPath $CSSFiles = Get-HTMLCSS -CSSPath $CSSPath get-content ($CSSFiles | ? {$_.name -eq "$CSSName.css"}).fullname | ForEach-Object{$StyleHeaderContent += "`r`n" + $_ } $Options=New-Object psobject -Property @{ Logos=$LogoSources; ScriptContent=$ScriptHeaderContent; StyleContent=$StyleHeaderContent; ColorSchemes=$ColorSchemes; } set-variable -Name GlobalColorSchemes -Value $ColorSchemes -Scope Global if ([string]::IsNullOrEmpty($SaveOptionsPath)) { Write-Output $Options } if(![string]::IsNullOrEmpty($SaveOptionsPath)) { if([String]::IsNullOrEmpty($SaveOptionsPath)) { if([string]::IsNullOrEmpty($PSScriptRoot)) { $SaveOptionsPath=$PSCmdlet.SessionState.Path.CurrentLocation.Path } else { $SaveOptionsPath=$PSScriptRoot } } Write-Verbose "Saving Report CSS to $SaveOptionsPath" $StyleHeaderContent|Set-Content -Path (Join-Path $SaveOptionsPath default.css) Write-Verbose "Saving Report Color Schemes to $SaveOptionsPath" foreach ($SchemeName in $ColorSchemes.Keys) { $ColorSchemes[$SchemeName]| ConvertTo-Csv -NoTypeInformation -Delimiter ';' | % {$_.Replace('"','')} | Out-File (Join-Path $SaveOptionsPath "$schemeName.rcs") } foreach ($LogoSource in $LogoSources.keys) { [IO.File]::WriteAllBytes((Join-Path $SaveOptionsPath "$LogoSource.jpg"), [Convert]::FromBase64String($LogoSources[$LogoSource].split(',')[1])) } foreach ($CSSFile in $CSSFiles) { get-content $CSSFile.FullName | set-content (Join-Path $SaveOptionsPath $CSSFile.name) } } } Function Get-HTMLLogos { <# .SYNOPSIS Get Base64 HTML #> [CmdletBinding()] param ( [Parameter(Mandatory=$false)] [String] $LogoPath ) if([String]::IsNullOrEmpty($LogoPath)) { if([string]::IsNullOrEmpty($PSScriptRoot)) { $LogoPath=$PSCmdlet.SessionState.Path.CurrentLocation.Path } else { $LogoPath = $PSScriptRoot #$LogoPath = 'C:\Users\matt.quickenden\Documents\GitHub\AzureFieldNotes\ReportHTML\ReportHTML' } } $LogoSources = @{} $ImageFiles = Get-ChildItem -Path (join-path $LogoPath '\*') -Include *.jpg,*.png,*.bmp foreach ($ImageFile in $ImageFiles) { Write-Verbose "Importing base64 for $($ImageFile.Name) from $ScriptPath" $LogoSources.Add($ImageFile.BaseName,'data:image/jpeg;base64,' + [Convert]::ToBase64String((Get-Content $ImageFile.FullName -Encoding Byte))) } Write-Output $LogoSources } Function Get-HTMLCSS { <# .SYNOPSIS Get's HTML Cascading Style Sheet .PARAMETER CSSName Name of the CSS #> [CmdletBinding()] param ( [Parameter(Mandatory=$false)] [String] $CSSPath, [Parameter(Mandatory=$false)] [String] $CSSName ) if([String]::IsNullOrEmpty($CSSPath)) { if([string]::IsNullOrEmpty($PSScriptRoot)) { $CSSPath=$PSCmdlet.SessionState.Path.CurrentLocation.Path } else { $CSSPath=$PSScriptRoot } } Write-Verbose "Retrieving *.css from $CSSPath" $CSSFiles = @((get-childitem $CSSPath -Filter '*.css')) if ([string]::IsNullOrEmpty($CSSName)) { Write-Output $CSSFiles } Else { get-content ($CSSFiles | ? {$_.basename -eq $CSSName}).fullname } } Function Get-HTMLJavaScripts { <# .SYNOPSIS Get's Script File from module directory #> [CmdletBinding()] param ( [Parameter(Mandatory=$false)] [String] $ScriptPath ) if([String]::IsNullOrEmpty($ScriptPath)) { if([string]::IsNullOrEmpty($PSScriptRoot)) { $ScriptPath=$PSCmdlet.SessionState.Path.CurrentLocation.Path } else { $ScriptPath=$PSScriptRoot } } Write-Verbose "Retrieving *.js from $ScriptPath" $ScriptFiles = @((get-childitem $ScriptPath -Filter '*.js' ).fullname) $ScriptHeaders = @() foreach ($ScriptFile in $ScriptFiles) { Write-Verbose "Generating Script Header from $ScriptFile" $ScriptHeaders += "`r`n" + '<script type="text/javascript"> '+ "`r`n" Get-Content $ScriptFile | ForEach-Object{$ScriptHeaders += $_ + "`r`n" } $ScriptHeaders += '</script> ' } Write-Output $ScriptHeaders } Function Get-HTMLColorSchemes { [CmdletBinding()] param ( [Parameter(Mandatory=$false)] [String]$SchemePath ) if([String]::IsNullOrEmpty($SchemePath)) { if([string]::IsNullOrEmpty($PSScriptRoot)) { $SchemePath=$PSCmdlet.SessionState.Path.CurrentLocation.Path } else { $SchemePath=$PSScriptRoot } } $Schemes=@{} Write-Verbose "Retrieving *.rcs from $SchemePath" $SchemeFiles = @(get-childitem $SchemePath -Filter '*.rcs' ) foreach ($SchemeFile in $SchemeFiles) { $SchemeContent=Import-Csv -Delimiter ';' -Path $SchemeFile.FullName $Schemes.Add($SchemeFile.BaseName,$SchemeContent) } $Schemes.add('Generated1',(GenerateRandomColorScheme -NumberOfSchemes 80)) $Schemes.add('Generated2',(GenerateRandomColorScheme -NumberOfSchemes 80)) $Schemes.add('Generated3',(GenerateRandomColorScheme -NumberOfSchemes 80)) $Schemes.add('Generated4',(GenerateRandomColorScheme -NumberOfSchemes 80)) $Schemes.add('Generated5',(GenerateRandomColorScheme -NumberOfSchemes 80)) $Schemes.add('Generated6',(GenerateRandomColorScheme -NumberOfSchemes 80)) $Schemes.add('Generated7',(GenerateRandomColorScheme -NumberOfSchemes 80)) $Schemes.add('Generated8',(GenerateRandomColorScheme -NumberOfSchemes 80)) Write-Output $Schemes } Function Connect-HTMLToAzure { [CmdletBinding()] Param ( $connectionName = "AzureRunAsConnection" ) Write-Output ("Prepare Azure Connection") try { # Get the connection "AzureRunAsConnection " $servicePrincipalConnection=Get-AutomationConnection -Name $connectionName #"Logging in to Azure..." Add-AzureRmAccount ` -ServicePrincipal ` -TenantId $servicePrincipalConnection.TenantId ` -ApplicationId $servicePrincipalConnection.ApplicationId ` -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint | Out-Null } catch { if (!$servicePrincipalConnection) { $ErrorMessage = "Connection $connectionName not found." throw $ErrorMessage } else{ Write-Error -Message $_.Exception throw $_.Exception } } } #endregion #region Internal Functions Function Get-Functions { PAram ($pattern, $path="$pwd\*", [switch]$Recurse = $false) $parser = [System.Management.Automation.PSParser] Get-ChildItem (join-Path $path '\*') -Recurse:$Recurse -Include *.ps1, *.psm1 | ForEach { $content = [IO.File]::ReadAllText($_.FullName) $tokens = $parser::Tokenize($content, [ref] $null) $count = $tokens.Count $( for($idx=0; $idx -lt $count; $idx += 1) { if($tokens[$idx].Content -eq 'function') { $targetToken = $tokens[$idx+1] New-Object PSObject -Property @{ FileName = $_.FullName FunctionName = $targetToken.Content Line = $targetToken.StartLine } | Select FunctionName, FileName, Line } } ) #| Where {$_.FunctionName -match $pattern} } } function Get-Parameters { Param ( $Cmdlet, [switch]$ShowCommon, [switch]$Full ) $command = Get-Command $Cmdlet -ea silentlycontinue # resolve aliases (an alias can point to another alias) while ($command.CommandType -eq "Alias") { $command = Get-Command ($command.definition) } if (-not $command) { return } foreach ($paramset in $command.ParameterSets){ $Output = @() foreach ($param in $paramset.Parameters) { if ( ! $ShowCommon ) { if ($param.aliases -match "vb|db|ea|wa|ev|wv|ov|ob|wi|cf") { continue } } $process = "" | Select-Object Name, Type, ParameterSet, Aliases, Position, IsMandatory, Pipeline, PipelineByPropertyName $process.Name = $param.Name if ( $param.ParameterType.Name -eq "SwitchParameter" ) { $process.Type = "Boolean" } else { switch -regex ( $param.ParameterType ) { "Nullable``1\[(.+)\]" { $process.Type = $matches[1].Split('.')[-1] + " (nullable)" ; break } default { $process.Type = $param.ParameterType.Name } } } if ( $paramset.name -eq "__AllParameterSets" ) { $process.ParameterSet = "Default" } else { $process.ParameterSet = $paramset.Name } $process.Aliases = $param.aliases if ( $param.Position -lt 0 ) { $process.Position = $null } else { $process.Position = $param.Position } $process.IsMandatory = $param.IsMandatory $process.Pipeline = $param.ValueFromPipeline $process.PipelineByPropertyName = $param.ValueFromPipelineByPropertyName $output += $process } if ( ! $Full ) { $Output | Select-Object Name, Type, ParameterSet, IsMandatory, Pipeline } else { Write-Output $Output } } } Function grc { <# .SYNOPSIS Random colour Function #> param( [int]$Min =0, [int]$max =255 ) Write-Output ([string](Get-Random -Maximum $max -Minimum $Min) + ',' ) } Function GenerateRandomColorScheme { <# .SYNOPSIS Generate a colour scheme .PARAMETER $NumberOfSchemes #> param ( [Parameter(Mandatory=$false)] [int] $NumberOfSchemes =1, $ColorSwing = 8 ) $Hover = '0.3)' $color = '0.6)' $border = '1)' $background = '0.7)' $ColorReference = Get-Random -Minimum 1 -Maximum 3 $BaseColor = (Get-Random -Maximum (200 - $ColorSwing) -Minimum (50 + $ColorSwing)) $BCMax = $BaseColor + $ColorSwing $BCMin = $BaseColor - $ColorSwing $ColorScheme = @() $i = 0 while ($i -ne $NumberOfSchemes ) { switch ($ColorReference) { 1 {$base = 'rgba('+ (grc -min $BCMin -max $BCMax) + (grc) + (grc) } 2 {$base = 'rgba('+ (grc) + (grc -min $BCMin -max $BCMax) + (grc) } 3 {$base = 'rgba('+ (grc) + (grc) + (grc -min $BCMin -max $BCMax) } } $Scheme = '' | select Colour,Background, Hover ,Border $Scheme.Background = $base + $background $Scheme.Border = $base + $border $Scheme.Colour = $base + $color $Scheme.Hover = $base + $Hover $ColorScheme += $Scheme $i++ } Write-Output $ColorScheme } #endregion #Region HTML Functions Function Get-HTMLOpenPage { <# .SYNOPSIS Get's HTML for the header of the HTML report .PARAMETER TitleText The title of the report .PARAMETER CSSLocation Directory containing CSS files. used in conjuction with CSSName .PARAMETER CSSName If only used with CSSLocation path will search for CSS file with CSSName, otherwise the CSSName can refernce one of the three built in templates. This function will Append .css extension #> [CmdletBinding(DefaultParameterSetName='options')] param ( [Parameter(Mandatory=$false,ParameterSetName='options')] [Parameter(Mandatory=$false,ParameterSetName='explicit')] [String]$TitleText, [Parameter(Mandatory=$false,ParameterSetName='explicit')] [String]$CSSPath, [Parameter(Mandatory=$false,ParameterSetName='explicit')] [String]$CSSName = "default", [Parameter(Mandatory=$false,ParameterSetName='explicit')] [String]$ScriptPath, [Parameter(Mandatory=$false,ParameterSetName='explicit')] [String]$ColorSchemePath, [Parameter(Mandatory=$false,ParameterSetName='explicit')] [String]$LogoPath, [Parameter(Mandatory=$false,ParameterSetName='explicit')] [string]$LeftLogoName = "Sample", [Parameter(Mandatory=$false,ParameterSetName='explicit')] [string]$RightLogoName = "Alternate", [Parameter(Mandatory=$false,ParameterSetName='explicit')] [string]$LeftLogoString, [Parameter(Mandatory=$false,ParameterSetName='explicit')] [string]$RightLogoString, [Parameter(Mandatory=$false,ParameterSetName='options')] [Parameter(Mandatory=$false,ParameterSetName='explicit')] [switch]$HideLogos, [Parameter(Mandatory=$false,ParameterSetName='options')] [Parameter(Mandatory=$false,ParameterSetName='explicit')] [switch]$HideTitle, [Parameter(Mandatory=$false,ParameterSetName='options')] [Parameter(Mandatory=$false,ParameterSetName='explicit')] [switch]$NoScript, [Parameter(Mandatory=$false,ParameterSetName='options')] [PSobject]$Options, [Parameter(Mandatory=$false,ParameterSetName='explicit')] [string]$PrimaryColorHex ) if($PSCmdlet.ParameterSetName -eq 'options') { if($Options -eq $null) { $Options=New-HTMLReportOptions } } else { if([String]::IsNullOrEmpty($RightLogoString) -eq $false -or [String]::IsNullOrEmpty($LeftLogoString) -eq $false) { $LogoSources=@{} if([String]::IsNullOrEmpty($RightLogoString) -eq $false) { $LogoSources.Add($RightLogoName,$RightLogoString) } if([String]::IsNullOrEmpty($LeftLogoString) -eq $false) { $LogoSources.Add($LeftLogoName,$LeftLogoString) } } if(!([String]::IsNullOrEmpty($LogoPath))){ $LogoSources = Get-HTMLLogos -logopath $LogoPath } $Options=New-HTMLReportOptions -LogoSources $LogoSources -CSSName $CSSName ` -CSSPath $CSSPath -ScriptPath $ScriptPath -ColorSchemePath $ColorSchemePath } if($HideLogos.IsPresent -eq $false) { $Leftlogo=$Options.Logos[$LeftLogoName] $Rightlogo=$Options.Logos[$RightLogoName] $LogoContent=@" <table><tbody> <tr> <td class="clientlogo"><img src="$Leftlogo" /></td> <td class="MainLogo"><img src="$Rightlogo" /></td> </tr> </tbody></table> "@ } $HtmlContent=@" <!DOCTYPE HTML> <!--- This page was autogenerated $CurrentDate By $env:USERNAME --> <html> <!-- Header --> <head> "@ if ($hideTitle.ispresent -eq $false) { $HtmlContent += " <Title>$TitleText</Title>" } $HtmlContent += @" <!-- Styles --> $($Options.StyleContent) <!-- Scripts --> $($Options.ScriptContent) </head> <!-- Body --> <body onload="hide();"> "@ if ($hideTitle.ispresent -eq $false) { $HtmlContent += @" <!-- Report Header --> $LogoContent <div class="pageTitle">$TitleText</div> <hr /> <div class="ReportCreated">Report created on $(Get-Date -format "MMM d, yyyy hh:mm tt")</div> "@ } if (!([string]::IsNullOrEmpty($PrimaryColorHex))) { if ($PrimaryColorHex.Length -eq 7) { $HtmlContent = $HtmlContent -replace '#337E94', $PrimaryColorHex } else { Write-Warning '$PrimaryColorHex must be 7 characters with hash eg "#337E94"' } } Write-Output $HtmlContent } Function Get-HTMLClosePage { <# .SYNOPSIS Get's the closing segment for the HTML .PARAMETER ClientLogoType The type of logo .PARAMETER AdditionalContent Some additional pish #> [CmdletBinding()] param( [String]$FooterText ) if ($FooterText -eq $null) { $Report = @" <hr /> <!-- FOOTER --> <div class="footer">Copyright © $([DateTime]::Now.Year) Azure Cloud Enablement. All Rights Reserved.</div> <!-- END BODY --> </body> </html> "@ } else { $Report = @" <hr /> <!-- FOOTER --> <div class="footer">$FooterText</div> <!-- END BODY --> </body> </html> "@ } Write-Output $Report } Function Get-HTMLContentOpen { <# .SYNOPSIS Creates a section in HTML .PARAMETER HeaderText The heading for the section .PARAMETER IsHidden Switch parameter to define if the section can collapse .PARAMETER BackgroundShade An int for 1 to 6 that defines background shading #> [CmdletBinding()] Param ( [Parameter(Mandatory = $false)] [string]$HeaderText, [Parameter(Mandatory = $false)] [switch]$IsHidden, [Parameter(Mandatory = $false)] [string]$Anchor, [Parameter(Mandatory = $false)] [validateset(1, 2, 3, 4, 5, 6)] [int]$BackgroundShade ) switch ($BackgroundShade) { 1 { $bgColorCode = "#F8F8F8" } 2 { $bgColorCode = "#D0D0D0" } 3 { $bgColorCode = "#A8A8A8" } 4 { $bgColorCode = "#888888" } 5 { $bgColorCode = "#585858" } 6 { $bgColorCode = "#282828" } default { $bgColorCode = "#ffffff" } } if ([String]::IsNullOrEmpty($Anchor)) { $InsertAnchor = 'name="' + $Anchor + '"' } #Below if statement will cause the content window to be hidden #With the "Show" option if the "IsHidden" switch is used. #If it is not used, then the window will remain open, not #hidden, with the "Hide" option if ($IsHidden) { $RandomNumber = Get-Random $Report = @" <div class="section"> <div class="header"> <a name="$($HeaderText)">$($HeaderText)</a> (<a id="show_$RandomNumber" href="javascript:void(0)" onclick="show('$RandomNumber');" style="color: #ffffff;">Show</a><a id="hide_$RandomNumber" href="#" onclick="hide('$RandomNumber');" style="color: #ffffff; display:none;">Hide</a>) </div> <div class="content" id="$RandomNumber" style="display:none;background-color:$($bgColorCode);"> "@ } else { $RandomNumber = Get-Random $Report = @" <div class="section"> <div class="header"> <a name="$($HeaderText)">$($HeaderText)</a> (<a id="hide_$RandomNumber" href="javascript:void(0)" onclick="hide('$RandomNumber');" style="color: #ffffff;">Hide</a><a id="show_$RandomNumber" href="javascript:void(0)" onclick="show('$RandomNumber');" style="color: #ffffff; display:none;">Show</a>) </div> <div class="content" id="$RandomNumber" style="background-color:$($bgColorCode);"> "@ } #Previous code came after above else statement #Changed the above so now the default is to always #show the "Hide" link on the content and if the #IsHidden switch is used then it hides the content #with the "Show" option <# $Report = @" <div class="section"> <div class="header"> <a name="$($HeaderText)">$($HeaderText)</a> </div> <div class="content" style="background-color:$($bgColorCode);"> "@ #> Return $Report } Function Get-HTMLContentClose { <# .SYNOPSIS Closes an HTML section #> [CmdletBinding()] param() $Report = @" </div> </div> "@ Return $Report } Function Get-HTMLContentTable { <# .SYNOPSIS Creates an HTML table from an array of objects .PARAMETER ArrayOfObjects An array of objects .PARAMETER Fixed fixes the html column width by the number of columns .PARAMETER GroupBy The column to group the data. make sure this is first in the array .PARAMETER Column Totals an Array of headers from that exist in the array of objects to be summed up #> param( [Array]$ArrayOfObjects, [String]$GroupBy, [Array]$ColumnCounts, [Switch]$Fixed, [Array]$ColumnAverages, [Switch]$NoSortableHeader, [Array]$ColumnTotals ) if ($GroupBy -eq '') { $Report = $ArrayOfObjects | ConvertTo-Html -Fragment $Report = $Report -replace '<col/>', "" -replace '<colgroup>', "" -replace '</colgroup>', "" $Report = $Report -replace "<tr>(.*)<td>Green</td></tr>","<tr class=`"green`">`$+</tr>" $Report = $Report -replace "<tr>(.*)<td>Yellow</td></tr>","<tr class=`"yellow`">`$+</tr>" $Report = $Report -replace "<tr>(.*)<td>Red</td></tr>","<tr class=`"red`">`$+</tr>" $Report = $Report -replace "<tr>(.*)<td>Odd</td></tr>","<tr class=`"odd`">`$+</tr>" $Report = $Report -replace "<tr>(.*)<td>Even</td></tr>","<tr class=`"even`">`$+</tr>" $Report = $Report -replace "<tr>(.*)<td>None</td></tr>","<tr>`$+</tr>" $Report = $Report -replace '<th>RowColor</th>', '' if ($Fixed.IsPresent) { $Report = $Report -replace '<table>', '<table class="fixed">' } else { if (!($NoSortableHeader)) { $Report = $Report -replace '<table>', '<table class="sortable">' } } } else { $NumberOfColumns = ($ArrayOfObjects | Get-Member -MemberType NoteProperty | Select-Object Name).Count $Groupings = @() $ArrayOfObjects | Select-Object $GroupBy -Unique | Sort-Object $GroupBy | ForEach-Object { $Groupings += [String]$_.$GroupBy} if ($Fixed.IsPresent) { $Report = '<table class="fixed">' } else { $Report = '<table>' } $GroupHeader = $ArrayOfObjects | ConvertTo-Html -Fragment $GroupHeader = $GroupHeader -replace '<col/>', "" -replace '<colgroup>', "" -replace '</colgroup>', "" -replace '<table>', "" -replace '</table>', "" -replace "<td>.+?</td>" -replace "<tr></tr>", "" $GroupHeader = $GroupHeader -replace '<th>RowColor</th>', '' $Report += $GroupHeader foreach ($Group in $Groupings) { $Report += "<tr><td colspan=`"$NumberOfColumns`" class=`"groupby`">$Group</td></tr>" $GroupBody = $ArrayOfObjects | Where-Object { [String]$($_.$GroupBy) -eq $Group } | Select-Object * -ExcludeProperty $GroupBy | ConvertTo-Html -Fragment $GroupBody = $GroupBody -replace '<col/>', "" -replace '<colgroup>', "" -replace '</colgroup>', "" -replace '<table>', "" -replace '</table>', "" -replace "<th>.+?</th>" -replace "<tr></tr>", "" -replace '<tr><td>', "<tr><td></td><td>" $GroupBody = $GroupBody -replace "<tr>(.*)<td>Green</td></tr>","<tr class=`"green`">`$+</tr>" $GroupBody = $GroupBody -replace "<tr>(.*)<td>Yellow</td></tr>","<tr class=`"yellow`">`$+</tr>" $GroupBody = $GroupBody -replace "<tr>(.*)<td>Red</td></tr>","<tr class=`"red`">`$+</tr>" $GroupBody = $GroupBody -replace "<tr>(.*)<td>Odd</td></tr>","<tr class=`"odd`">`$+</tr>" $GroupBody = $GroupBody -replace "<tr>(.*)<td>Even</td></tr>","<tr class=`"even`">`$+</tr>" $GroupBody = $GroupBody -replace "<tr>(.*)<td>None</td></tr>","<tr>`$+</tr>" $Report += $GroupBody } } $Report = $Report -replace 'URL01NEW', '<a target="_blank" href="' $Report = $Report -replace 'URL01', '<a href="' $Report = $Report -replace 'URL02', '">' $Report = $Report -replace 'URL03', '</a>' if ($Report -like "*<tr>*" -and $report -like "*odd*" -and $report -like "*even*") { $Report = $Report -replace "<tr>",'<tr class="header">' } if ($ColumnTotals.count -gt 0 -or $ColumnAverages.count -gt 0 -or $ColumnCounts.count -gt 0 ) { $Report = $Report -replace "</table>","" $TableFooter = $ArrayOfObjects | ConvertTo-Html -Fragment $TableFooter = $TableFooter -replace '<col/>', "" -replace '<colgroup>', "" -replace '</colgroup>', "" -replace '<table>', "" -replace '</table>', "" -replace "<td>.+?</td>" -replace "<tr></tr>", "" $TableFooter = $TableFooter -replace '<th>RowColor</th>', '' #$ColumnTotal foreach ($ColumnTotal in $ColumnTotals) { $TableFooter = $TableFooter -replace $ColumnTotal,("sum:" + ($arrayofobjects | measure $ColumnTotal -Sum ).sum) } #ColumnAverage foreach ($ColumnAverage in $ColumnAverages) { $TableFooter = $TableFooter -replace $ColumnAverage,("avg:" +($arrayofobjects | measure $ColumnAverage -Average ).average) } #ColumnCount foreach ($ColumnCount in $ColumnCounts) { $TableFooter = $TableFooter -replace $ColumnCount,("count:"+ ($arrayofobjects | measure $ColumnCount).count) } #Cleanup foreach ($Column in ($ArrayOfObjects | Get-Member )) { $TableFooter = $TableFooter -replace ("<th>" + $Column.Name + "</th>"), '<td></td>' } $TableFooter = $TableFooter -replace '<th>', '<td class="totalrow">' -replace "</th>", '</td>' $TableFooter = $TableFooter -replace '<tr>', '<tr class="totalrow">' $Report += "<tfoot>" $Report += $TableFooter $Report += "</tfoot>" } $Report += "</table>" return $Report } Function Get-HTMLContentTableAdvanced { <# .SYNOPSIS Code borrowed from https://www.powershellgallery.com/packages/EnhancedHTML2 #> param( [Parameter(Mandatory=$True,ValueFromPipeline=$True)] [Array]$ArrayOfObjects ) $out = '' $out += "<table>" foreach ($object in $ArrayOfObjects) { $datarow = '' $headerrow = '' $properties = $object | Get-Member -MemberType Properties | Select -ExpandProperty Name foreach ($prop in $properties) { #$prop = $properties[0] $name = $null $value = $null if ($prop -is [string]) { $name = $Prop $value = $object.($prop) } else { Write-Warning "Unhandled property $prop" } $headerrow += "<th>$name</th>" $datarow += "<td>$value</td>" } if (-not $wrote_first_line ) { $out += "<tr>$headerrow</tr><tbody>" $wrote_first_line = $true } $out += "<tr>$datarow</tr>" } $out += "</table>" return $out } Function Get-HTMLContentDataTable { <# .SYNOPSIS Creates an HTML 5 Data table from an array of objects .PARAMETER ArrayOfObjects An array of objects .PARAMETER Paging .PARAMETER PagingOptions .PARAMETER Ordering .PARAMETER Info .PARAMETER HideFooter #> param ( [Parameter(Mandatory=$True,ValueFromPipeline=$True)] [Array]$ArrayOfObjects, [Parameter(Mandatory=$false,ValueFromPipeline=$false)] [switch]$DisablePaging, [Parameter(Mandatory=$false,ValueFromPipeline=$false)] [string]$PagingOptions = '15,25, 50, 100,', [Parameter(Mandatory=$false,ValueFromPipeline=$false)] [switch]$DisableOrdering, [Parameter(Mandatory=$false,ValueFromPipeline=$false)] [switch]$DisableInfo, [Parameter(Mandatory=$false,ValueFromPipeline=$false)] [switch]$HideFooter ) if ($DisablePaging -eq $true) {$Paging = 'false'} else {$Paging = 'true'} if ($DisableOrdering -eq $true) {$Ordering = 'false'} else {$Ordering = 'true'} if ($DisableInfo -eq $true) {$Info = 'false'} else {$Info = 'true'} $DTInstance = (-join ((65..90) + (97..122) | Get-Random -Count 8 | % {[char]$_})).tolower() $TableHeader = @' <script> $(document).ready(function() { $('# '@ $TableHeader += $DTInstance $TableHeader += @" ').DataTable({ "paging": $($Paging), "pagingType": "full_numbers", "lengthMenu": [[$PagingOptions -1], [$PagingOptions "All"]], "ordering": $($Ordering), "info": $($Info), "columns": [ "@ $ArraryHeader = $ArrayOfObjects | ConvertTo-Html -Fragment $HeadersText = ($ArraryHeader[2] -replace '<tr>','' -replace '<th>','' -replace '</tr>','') $ColumnHeaders = ($HeadersText.substring(0,$HeadersText.Length-5)) -split '</th>' foreach ($ColumnHeader in $ColumnHeaders ) { $TableHeader += '{ "data": "' + $ColumnHeader + '" },' } $TableHeader += @' ] }); } ); </script> '@ $TableHeader = $TableHeader.Replace(',]',']') $NumberOfColumns = ($ArrayOfObjects | Get-Member -MemberType NoteProperty | Select-Object Name).Count $Report = $ArrayOfObjects | ConvertTo-Html -Fragment $Report = $Report -replace '<col/>', "" -replace '<colgroup>', "" -replace '</colgroup>', "" $Report = $Report -replace '<table>', ('<table id="' + $DTInstance + '" class="display compact"><thead>') $Report = $Report -replace '</th></tr>','</th></tr></thead><tbody>' $Report = $Report -replace "</table>","LoadFooterHere</tbody>" if ($HideFooter -eq $true) { $Report = $Report -replace "LoadFooterHere","" } else { $Footer = '<tfoot><tr>' foreach ($Header in $ColumnHeaders){ $Footer += '<th>' + $Header + '</th>' } $Footer += '</tr></tfoot>' $Report = $Report -replace "LoadFooterHere",$Footer } $Report = $Report -replace 'URL01NEW', '<a target="_blank" href="' $Report = $Report -replace 'URL01', '<a href="' $Report = $Report -replace 'URL02', '">' $Report = $Report -replace 'URL03', '</a>' $Report += "</table>" return ($TableHeader + $Report) } Function Get-HTMLContentText { <# .SYNOPSIS Creates an HTML entry with heading and detail .PARAMETER Heading The type of logo .PARAMETER Detail Some additional pish #> [CmdletBinding()] param ( [Parameter(Mandatory=$false)] [String] $Heading, [Parameter(Mandatory=$false)] [String] $Detail ) $Report = @" <table><tbody> <tr> <th class="content">$Heading</th> <td class="content">$($Detail)</td> </tr> </tbody></table> "@ $Report = $Report -replace 'URL01NEW', '<a target="_blank" href="' $Report = $Report -replace 'URL01', '<a href="' $Report = $Report -replace 'URL02', '">' $Report = $Report -replace 'URL03', '</a>' Return $Report } Function Set-TableRowColor { <# .SYNOPSIS adds a row colour field to the array of object for processing with htmltable .PARAMETER ArrayOfObjects The type of logo .PARAMETER Green Some additional pish .PARAMETER Yellow Some additional pish .PARAMETER Red use $this and an expression to measure the value .PARAMETER Alertnating a switch the will define Odd and Even Rows in the rowcolor column #> [CmdletBinding()] Param ( [Parameter(Mandatory=$false)] [Object[]]$ArrayOfObjects, [Parameter(Mandatory=$false)] [string]$Green = '$this -eq $false', [Parameter(Mandatory=$false)] [string]$Yellow = '$this -eq $false', [Parameter(Mandatory=$false)] [string]$Red = '$this -eq $false', [Parameter(Mandatory=$false)] [switch]$Alternating ) if ($Alternating) { $ColoredArray = $ArrayOfObjects | Add-Member -MemberType ScriptProperty -Name RowColor -Value { if ((([array]::indexOf($ArrayOfObjects,$this)) % 2) -eq 0) {'Odd'} if ((([array]::indexOf($ArrayOfObjects,$this)) % 2) -eq 1) {'Even'} } -PassThru -Force | Select-Object * } else { $ColoredArray = $ArrayOfObjects | Add-Member -MemberType ScriptProperty -Name RowColor -Value { if (Invoke-Expression $Green) {'Green'} elseif (Invoke-Expression $Red) {'Red'} elseif (Invoke-Expression $Yellow) {'Yellow'} else {'None'} } -PassThru -Force | Select-Object * } return $ColoredArray } Function Get-HTMLColumn1of2 { <# .SYNOPSIS adds a row colour field to the array of object for processing with htmltable .PARAMETER PieChartObject This is a custom object with Pie chart properties, Create-HTMLPieChartObject .PARAMETER PieChartData Required an array with the headings Name and Count. Using Powershell Group-object on an array #> [CmdletBinding()] param() $report = '<div class="first column">' return $report } Function Get-HTMLColumn2of2 { <# .SYNOPSIS adds a row colour field to the array of object for processing with htmltable .PARAMETER PieChartObject This is a custom object with Pie chart properties, Create-HTMLPieChartObject .PARAMETER PieChartData Required an array with the headings Name and Count. Using Powershell Group-object on an array #> [CmdletBinding()] param() $report = '<div class="second column">' return $report } Function Get-HTMLColumnClose { <# .SYNOPSIS Closing Div Tag #> [CmdletBinding()] param() $report = '</div>' return $report } Function Get-HTMLColumnOpen { <# .SYNOPSIS Dynamic Column Creation .PARAMETER NumberOf This is a current column number .PARAMETER ColumnTotal Total Number of columns #> [CmdletBinding()] param ( [Parameter(Mandatory=$true)] [int]$ColumnNumber, [Parameter(Mandatory=$true)] [int]$ColumnCount ) $ColumnItem = [string]$ColumnNumber + "of" + [string]$ColumnCount Write-Verbose $ColumnItem $ColumnItem = $ColumnItem.replace('1','one').replace('2','two').replace('3','three').replace('4','four').replace('5','five').replace('6','six') Write-Verbose $ColumnItem $report = '<div class="' + $ColumnItem + ' column">' return $report } Function Get-HTMLAnchorLink { <# .SYNOPSIS creates Hyperlink for an Anchor .PARAMETER AnchorName The Actual name of the Anchor (Hidden) .PARAMETER AnchorText The HyperLink text. Will default to $AnchorNname if not specified #> [CmdletBinding()] Param ( [Parameter(Mandatory=$false)] [String] $AnchorName, [Parameter(Mandatory=$true)] [String] $AnchorText ) if ($AnchorText -eq $null -or $AnchorText -eq '') {$AnchorText=$AnchorName} $report = '<a class="alink" href="#' + $AnchorName + '">' + $AnchorText +'</a>' Write-Output $report } Function Get-HTMLAnchor { <# .SYNOPSIS creates an Anchor .PARAMETER AnchorName The Actual Anchor #> [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [String] $AnchorName ) $Anchor = '<a name="' + $AnchorName + '"></a>' Write-Output $Anchor } Function Get-HTMLTabHeader { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [Array] $TabNames ) $TabHeader = @() $TabHeader += '<ul class="tab">' $FirstTab = $true Foreach ($TabName in $TabNames) { if ($FirstTab) { $TabHeader += ' <li><a href="javascript:void(0)" class="tablinks" onclick="openTab(event, ''' + $TabName + ''')" id="defaultOpen">' + $TabName + '</a></li>' $FirstTab = $false } else { $TabHeader += ' <li><a href="javascript:void(0)" class="tablinks" onclick="openTab(event, ''' + $TabName + ''')">' + $TabName + '</a></li>' } } $TabHeader += '</ul>' Set-Variable -Scope global -Name TabHeaderCreated -Value $true Write-output $TabHeader } Function Get-HTMLTabContentOpen { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [String] $TabName, [Parameter(Mandatory=$true)] [String] $TabHeading ) $TabContent = @() $TabContent += '<div id="' + $TabName +'" class="tabcontent">' $TabContent += "<h7>$TabHeading</h7>" write-output $TabContent } Function Get-HTMLTabContentClose { $tabclose = @() $tabclose += "</p>" $tabclose += '</div>' $tabclose += @" <script> // Get the element with id="defaultOpen" and click on it document.getElementById("defaultOpen").click(); </script> "@ write-output $tabclose } Function Get-HTMLCodeBlock { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [String] $Code, [Parameter(Mandatory=$false)] [String] $Style = 'PowerShell' ) $CodeBlock = @() switch ($Style) { 'PowerShell' { $CodeBlock += '<pre class="PowerShell">' } 'othercodestyleneedsACSSStyle' { $CodeBlock += '<pre class="PowerShell">' } default { $CodeBlock += '<pre>' } } $CodeBlock += $Code $CodeBlock += '</pre>' [string]$CodeBlock = $CodeBlock Write-Output $CodeBlock } function Get-HTMLSpan { Param ( $block, $tokenColor ) # # Original Author: Lee Holmes, http://www.leeholmes.com/blog/MorePowerShellSyntaxHighlighting.aspx # # Modified by: Helge Klein, http://blogs.sepago.de/helge/ # if (($tokenColor -eq 'NewLine') -or ($tokenColor -eq 'LineContinuation')) { if($tokenColor -eq 'LineContinuation') { $null = $codeBuilder.Append('`') } $null = $codeBuilder.Append("<br />`r`n") } else { $block = [System.Web.HttpUtility]::HtmlEncode($block) if (-not $block.Trim()) { $block = $block.Replace(' ', ' ') } $htmlColor = $tokenColours[$tokenColor].ToString().Replace('#FF', '#') if($tokenColor -eq 'String') { $lines = $block -split "`r`n" $block = "" $multipleLines = $false foreach($line in $lines) { if($multipleLines) { $block += "<BR />`r`n" } $newText = $line.TrimStart() $newText = " " * ($line.Length - $newText.Length) + $newText $block += $newText $multipleLines = $true } } $null = $codeBuilder.Append("<span style='color:$htmlColor'>$block</span>") } } Function Get-HTMLPowerShellSyntax { [CmdletBinding()] Param ( $PowerShellFilePath ) # # Original Author: Lee Holmes, http://www.leeholmes.com/blog/MorePowerShellSyntaxHighlighting.aspx # # Modified by: Helge Klein, http://blogs.sepago.de/helge/ # # # Syntax highlights a PowerShell script. # # Usage: Supply the script to syntax hightligh as first and only parameter # # Output: Copy of original script with extension ".html" # # Example: .\Highlight-Syntax.ps1 .\Get-AppVPackageDependencies.ps1 # # Version history: # # 1.1: # # - Loading the required assembly System.Web now. This was missing earlier. # # 1.0: Initial version # $path = $PowerShellFilePath # Load required assemblies [void] [System.Reflection.Assembly]::Load("System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") $tokenColours = @{ 'Attribute' = '#FFADD8E6' 'Command' = '#FF0000FF' 'CommandArgument' = '#FF8A2BE2' 'CommandParameter' = '#FF000080' 'Comment' = '#FF006400' 'GroupEnd' = '#FF000000' 'GroupStart' = '#FF000000' 'Keyword' = '#FF00008B' 'LineContinuation' = '#FF000000' 'LoopLabel' = '#FF00008B' 'Member' = '#FF000000' 'NewLine' = '#FF000000' 'Number' = '#FF800080' 'Operator' = '#FFA9A9A9' 'Position' = '#FF000000' 'StatementSeparator' = '#FF000000' 'String' = '#FF8B0000' 'Type' = '#FF008080' 'Unknown' = '#FF000000' 'Variable' = '#FFFF4500' } # Generate an HTML span and append it to HTML string builder $currentLine = 1 $text = $null if($path) { $text = (Get-Content $path) -join "`r`n" } else { Write-Error 'Please supply the path to the PowerShell script to syntax highlight as first (and only) parameter.' return } trap { break } # Do syntax parsing. $errors = $null $tokens = [system.management.automation.psparser]::Tokenize($Text, [ref] $errors) # Initialize HTML builder. $codeBuilder = new-object system.text.stringbuilder # Iterate over the tokens and set the colors appropriately. $position = 0 foreach ($token in $tokens) { if ($position -lt $token.Start) { $block = $text.Substring($position, ($token.Start - $position)) $tokenColor = 'Unknown' Get-HtmlSpan $block $tokenColor } $block = $text.Substring($token.Start, $token.Length) $tokenColor = $token.Type.ToString() Get-HtmlSpan $block $tokenColor $position = $token.Start + $token.Length } # Build the entire syntax-highlighted script $code = $codeBuilder.ToString() # Replace tabs with three blanks $code = $code -replace "\t"," " if ($WriteToPath) { # Write the HTML to a file $code | set-content -path "$path.html" } else { write-output $code } } Function Get-HTMLHeading { Param ( [string]$headingText, [int]$headerSize ) $headerString = "<h$headerSize>$headingText</h$headerSize>" return $headerString } #endregion #Region Chart JS Functions Function Get-HTMLBarChartObject { <# .SYNOPSIS create a Bar chart object for use with Get-HTMLBarChart #> [CmdletBinding()] param( [Parameter(Mandatory=$false)] $ColorScheme ) $ChartSize = New-Object PSObject -Property @{` Width = 500 Height = 400 } $DataDefinition = New-Object PSObject -Property @{` DataSetName = "Data" AxisXTitle = "" AxisYTitle = "" DataNameColumnName = "name" DataValueColumnName = "count" } if ($ColorScheme -eq "Generated") {$thisColorScheme = 'Generated' + [string](Get-Random -Minimum 1 -Maximum 8)} elseif ($ColorScheme -eq "Random") {$thisColorScheme = 'Random' } else {$thisColorScheme = 'ColorScheme1'} $ChartStyle = New-Object PSObject -Property @{` ChartType = "bar" ColorSchemeName = "$thisColorScheme" Showlabels= $true borderWidth = "1" responsive = 'false' legendPosition = 'bottom' } $ChartObject = New-Object PSObject -Property @{` ObjectName = -join ((65..90) + (97..122) | Get-Random -Count 12 | ForEach-Object {[char]$_}) Title = "" Size = $ChartSize DataDefinition = $DataDefinition ChartStyle = $ChartStyle } return $ChartObject } Function Get-HTMLBarChart { <# .SYNOPSIS #> [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] $ChartObject, [Parameter(Mandatory=$true)] [Array] $DataSet, [Parameter(Mandatory=$false)] $Options ) $DataCount = $DataSet.Count Write-Verbose "Data Set counnt is $DataCount" if ($ChartObject.ChartStyle.ColorSchemeName -ne 'Random') { if ($Options -eq $null) { #Write-Verbose "Default Colour Schemes selected, selecting $($ChartObject.ChartStyle.ColorSchemeName)" #$ColorSchemes = Get-HTMLColorSchemes $ChartColorScheme = $GlobalColorSchemes.($ChartObject.ChartStyle.ColorSchemeName) | select -First $DataCount } else { Write-Verbose "Options Colour Schemes selected, selecting $($ChartObject.ChartStyle.ColorSchemeName)" $ChartColorScheme = $Options.ColorSchemes.($ChartObject.ChartStyle.ColorSchemeName) | select -First $DataCount } if ($ChartColorScheme.Count -lt $DataCount) { Write-Warning ("Colorscheme " + $ChartObject.ChartStyle.ColorSchemeName + " only has " + $ChartColorScheme.Count + " schemes, you have $DataCount Records. Generating one for you" ) $ChartColorScheme = GenerateRandomColorScheme -numberofschemes $DataCount } } else { $ChartColorScheme = GenerateRandomColorScheme -numberofschemes $DataCount } $ofs = ',' $CJSHeader = @() $CJSHeader += '<canvas id="' + $ChartObject.ObjectName + '" width="'+ $ChartObject.Size.Width + '" height="' + $ChartObject.Size.Height +'"></canvas>' $CJSHeader += '<script>' $CJSHeader += 'var ctx = document.getElementById("' + $ChartObject.ObjectName + '");' $CJSHeader += 'var ' + $ChartObject.ObjectName + ' = new Chart(ctx, {' $CJSHeader += " type: '$($ChartObject.ChartStyle.ChartType)'," $CJSData = @() $CJSData = " data: {"+ "`n" if ($ChartObject.ChartStyle.Showlabels) { $ofs ='","' $CJSData += ' labels: ["' +"$($DataSet.($ChartObject.DataDefinition.DataNameColumnName))" + '"],' + "`n" } $CJSData += " datasets: [{" + "`n" $CJSData += " label: '$($chartobject.DataDefinition.datasetname)'," + "`n" $ofs ="," $CJSData += " data: [" + "$($DataSet | % {$_.($ChartObject.DataDefinition.DataValueColumnName)})" +"]," + "`n" $ofs ="','" $CJSData += " backgroundColor: ['" + "$($ChartColorScheme.Background)" + "']," + "`n" $CJSData += " borderColor: ['" + "$($ChartColorScheme.border)" + "']," + "`n" $CJSData += " hoverBackgroundColor: ['" + "$($ChartColorScheme.border)" + "']," + "`n" $CJSData += " borderWidth: $($ChartObject.ChartStyle.borderWidth)" + "`n" $CJSData += " }]"+ "`n" $CJSData += " }," $ofs ="" $CJSOptions = @() $cjsOptions += ' options: {' #responsive $cjsOptions += " responsive: $($ChartObject.ChartStyle.responsive)," #legend $cjsOptions += " legend: { position: '$($ChartObject.ChartStyle.legendposition)', }," #title if ($ChartObject.Title -ne '') { $cjsOptions += " title: { display: true, text: '$($ChartObject.Title)' }," } #scale & Labels $XAxisLabel = $ChartObject.DataDefinition.AxisXTitle if ([string]::IsNullOrEmpty($XAxisLabel)) { $displayXAxisLabel = 'false' } else { $displayXAxisLabel = 'true' } $YAxisLabel = $ChartObject.DataDefinition.AxisYTitle if ([string]::IsNullOrEmpty($YAxisLabel)) { $displayYAxisLabel = 'false' } else { $displayYAxisLabel = 'true' } $CJSOptions += "scales: { xAxes: [{ display: $displayXAxisLabel, scaleLabel: { display: $displayXAxisLabel, labelString: '$XAxisLabel' } }], yAxes: [{ display: $displayYAxisLabel, scaleLabel: { display: $displayYAxisLabel, labelString: '$YAxisLabel' }, ticks: { beginAtZero:true } }] }, " $cjsOptions += " }" +"`n" $CJSOptions += "}); " $CJSFooter = " </script>" $CJS = @() $CJS += $CJSHeader $CJS += $CJSData $CJS += $CJSOptions $CJS += $CJSFooter write-output $CJS } Function Get-HTMLPieChartObject { <# .SYNOPSIS create a Bar chart object for use with Get-HTMLBarChart #> [CmdletBinding()] param( [ValidateSet("pie","doughnut")] [String] $ChartType = 'pie', [Parameter(Mandatory=$false)] $ColorScheme ) $ChartSize = New-Object PSObject -Property @{` Width = 500 Height = 400 } $DataDefinition = New-Object PSObject -Property @{` DataSetName = "Data" DataNameColumnName = "name" DataValueColumnName = "count" } if ($ColorScheme -eq "Generated") {$thisColorScheme = 'Generated' + [string](Get-Random -Minimum 1 -Maximum 8)} elseif ($ColorScheme -eq "Random") {$thisColorScheme = 'Random' } else {$thisColorScheme = 'ColorScheme2'} $ChartStyle = New-Object PSObject -Property @{` ChartType = $ChartType ColorSchemeName = "$thisColorScheme" Showlabels= $true borderWidth = "1" responsive = 'false' animateScale = 'true' animateRotate = 'true' legendPosition = 'bottom' } $ChartObject = New-Object PSObject -Property @{` ObjectName = -join ((65..90) + (97..122) | Get-Random -Count 12 | ForEach-Object {[char]$_}) Title = "" Size = $ChartSize DataDefinition = $DataDefinition ChartStyle = $ChartStyle } return $ChartObject } Function Get-HTMLPieChart { <# .SYNOPSIS #> [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] $ChartObject, [Parameter(Mandatory=$true)] [Array] $DataSet, [Parameter(Mandatory=$false)] $Options ) $DataCount = $DataSet.Count Write-Verbose "Data Set counnt is $DataCount" if ($ChartObject.ChartStyle.ColorSchemeName -ne 'Random') { if ($Options -eq $null) { #Write-Verbose "Default Colour Schemes selected, selecting $($ChartObject.ChartStyle.ColorSchemeName)" #$ColorSchemes = Get-HTMLColorSchemes $ChartColorScheme = $GlobalColorSchemes.($ChartObject.ChartStyle.ColorSchemeName) | select -First $DataCount } else { Write-Verbose "Options Colour Schemes selected, selecting $($ChartObject.ChartStyle.ColorSchemeName)" $ChartColorScheme = $Options.ColorSchemes.($ChartObject.ChartStyle.ColorSchemeName) | select -First $DataCount } if ($ChartColorScheme.Count -lt $DataCount) { Write-Warning ("Colorscheme " + $ChartObject.ChartStyle.ColorSchemeName + " only has " + $ChartColorScheme.Count + " schemes, you have $DataCount Records. Generating one for you" ) $ChartColorScheme = GenerateRandomColorScheme -numberofschemes $DataCount } } else { $ChartColorScheme = GenerateRandomColorScheme -numberofschemes $DataCount } $ofs = ',' $CJSHeader = @() $CJSHeader += '<canvas id="' + $ChartObject.ObjectName + '" width="'+ $ChartObject.Size.Width + '" height="' + $ChartObject.Size.Height +'"></canvas>' $CJSHeader += '<script>' $CJSHeader += 'var ctx = document.getElementById("' + $ChartObject.ObjectName + '");' $CJSHeader += 'var ' + $ChartObject.ObjectName + ' = new Chart(ctx, {' $CJSHeader += " type: '$($ChartObject.ChartStyle.ChartType)'," $CJSData = @() $CJSData = " data: {"+ "`n" if ($ChartObject.ChartStyle.Showlabels) { $ofs ='","' $CJSData += ' labels: ["' +"$($DataSet.($ChartObject.DataDefinition.DataNameColumnName))" + '"],' + "`n" } $CJSData += " datasets: [{" + "`n" $CJSData += " label: '$($chartobject.DataDefinition.datasetname)'," + "`n" $ofs ="," $CJSData += " data: [" + "$($DataSet | % {$_.($ChartObject.DataDefinition.DataValueColumnName)})" +"]," + "`n" $ofs ="','" $CJSData += " backgroundColor: ['" + "$($ChartColorScheme.Background)" + "']," + "`n" $CJSData += " hoverBackgroundColor: ['" + "$($ChartColorScheme.border)" + "']," + "`n" $CJSData += " borderWidth: $($ChartObject.ChartStyle.borderWidth)" + "`n" $CJSData += " }]"+ "`n" $CJSData += " }," $ofs ="" $CJSOptions = @() $cjsOptions += ' options: {' #responsive $cjsOptions += " responsive: $($ChartObject.ChartStyle.responsive)," #legend $cjsOptions += " legend: { position: '$($ChartObject.ChartStyle.legendposition)', }," #Title if ($ChartObject.Title -ne '') { $cjsOptions += " title: { display: true, text: '$($ChartObject.Title)' }," } $cjsOptions += " }," #animation $cjsOptions += " animation: { animateScale: $($ChartObject.ChartStyle.animateScale), animateRotate: $($ChartObject.ChartStyle.animateRotate) }" $CJSOptions += "}); " $CJSFooter = " </script>" $CJS = @() $CJS += $CJSHeader $CJS += $CJSData $CJS += $CJSOptions $CJS += $CJSFooter write-output $CJS } Function Get-HTMLStackedChartObject { <# .SYNOPSIS create a Stacked chart object for use with Get-HTMLStackedChart #> [CmdletBinding()] param( [Parameter(Mandatory=$false)] $ColorScheme, #[Parameter(Mandatory=$true)] [String] $DataSetArrayXLabels='Date', #[Parameter(Mandatory=$true)] [String] $DataSetArrayName='OwnerSolution', #[Parameter(Mandatory=$true)] [String] $DataSetArrayData='usagedata', #[Parameter(Mandatory=$true)] [String] $DataSetArrayDataColumn='cost' ) $ChartSize = New-Object PSObject -Property @{` Width = 1000 Height = 400 } $DataDefinition = New-Object PSObject -Property @{` DataSetArrayData = $DataSetArrayData DataSetArrayName = $DataSetArrayName DataSetArrayXLabels = $DataSetArrayXLabels DataSetArrayDataColumn = $DataSetArrayDataColumn } if ($ColorScheme -eq "Generated") {$thisColorScheme = 'Generated' + [string](Get-Random -Minimum 1 -Maximum 8)} elseif ($ColorScheme -eq "Random") {$thisColorScheme = 'Random' } else {$thisColorScheme = 'ColorScheme2'} $ChartStyle = New-Object PSObject -Property @{` ChartType = 'line' ColorSchemeName = "$thisColorScheme" Showlabels= $true yAxesStacked= 'true' borderWidth = "1" responsive = 'false' animateScale = 'true' animateRotate = 'true' legendPosition = 'bottom' tooltips = New-Object PSObject -Property @{` mode = 'dataset' intersect = 'true' } hover = New-Object PSObject -Property @{` mode = 'point' intersect = 'true' } } $ChartObject = New-Object PSObject -Property @{` ObjectName = -join ((65..90) + (97..122) | Get-Random -Count 12 | ForEach-Object {[char]$_}) Title = "" Size = $ChartSize DataDefinition = $DataDefinition ChartStyle = $ChartStyle } return $ChartObject } #$ChartObject = Get-HTMLStackedChartObject Function Get-HTMLStackedChart { <# .SYNOPSIS #> [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] $ChartObject, [Parameter(Mandatory=$true)] [Array] $DataSet, [Parameter(Mandatory=$false)] $Options ) $DataCount = $DataSet.Count Write-Verbose "Data Set count is $DataCount" if ($ChartObject.ChartStyle.ColorSchemeName -ne 'Random') { if ($Options -eq $null) { #Write-Verbose "Default Colour Schemes selected, selecting $($ChartObject.ChartStyle.ColorSchemeName)" #$ColorSchemes = Get-HTMLColorSchemes $ChartColorScheme = $GlobalColorSchemes.($ChartObject.ChartStyle.ColorSchemeName) | select -First $DataCount } else { Write-Verbose "Options Colour Schemes selected, selecting $($ChartObject.ChartStyle.ColorSchemeName)" $ChartColorScheme = $Options.ColorSchemes.($ChartObject.ChartStyle.ColorSchemeName) | select -First $DataCount } if ($ChartColorScheme.Count -lt $DataCount) { Write-Warning ("Colorscheme " + $ChartObject.ChartStyle.ColorSchemeName + " only has " + $ChartColorScheme.Count + " schemes, you have $DataCount Records. Generating one for you" ) $ChartColorScheme = GenerateRandomColorScheme -numberofschemes $DataCount -ColorSwing (($DataCount/2)+8) } } else { $ChartColorScheme = GenerateRandomColorScheme -numberofschemes $DataCount -ColorSwing (($DataCount/2)+8) } $ofs = ',' $CJSHeader = @() $CJSHeader += '<canvas id="' + $ChartObject.ObjectName + '" width="'+ $ChartObject.Size.Width + '" height="' + $ChartObject.Size.Height +'"></canvas>' $CJSHeader += '<script>' $CJSHeader += 'var ctx = document.getElementById("' + $ChartObject.ObjectName + '");' $CJSHeader += 'var ' + $ChartObject.ObjectName + ' = new Chart(ctx, {' $CJSHeader += " type: '$($ChartObject.ChartStyle.ChartType)'," $CJSData = @() $CJSData = " data: {"+ "`n" if ($ChartObject.ChartStyle.Showlabels) { $ofs ='","' $CJSData += ' labels: ["' +"$([string]($DataSet.($ChartObject.DataDefinition.DataSetArrayData).($ChartObject.DataDefinition.DataSetArrayXLabels) | select -Unique))" + '"],' + "`n" } $rowCount = 0 $CJSData += " datasets: [" #$Set = $DataSet[4] Foreach ($Set in $DataSet) { $CJSData += " {" + "`n" $CJSData += " label: '$($Set.($ChartObject.DataDefinition.DataSetArrayName))'," + "`n" $ofs ="," $CJSData += " fill: true," + "`n" $CJSData += " data: [" + "$([string]($Set.($ChartObject.DataDefinition.DataSetArrayData).($chartObject.DataDefinition.DataSetArrayDataColumn)))" +"]," + "`n" $ofs ="','" $CJSData += " borderCapStyle: 'butt'," + "`n" $CJSData += " backgroundColor: '$($ChartColorScheme[$rowcount].Background)'," + "`n" $CJSData += " pointBackgroundColor: '$($ChartColorScheme[$rowcount].Border)'," + "`n" $CJSData += " pointHighlightStroke: '$($ChartColorScheme[$rowcount].Border)'," + "`n" $CJSData += " borderColor: '$($ChartColorScheme[$rowcount].Border)'," + "`n" if ($rowCount -ne ($DataSet.Count -1)) { $CJSData += " }," } else { $CJSData += " }" } $rowCount++ } $CJSData += " ]"+ "`n" $CJSData += " }," $ofs ="" $CJSOptions = @() $cjsOptions += ' options: {' #responsive $cjsOptions += " responsive: $($ChartObject.ChartStyle.responsive)," #legend $cjsOptions += " legend: { position: '$($ChartObject.ChartStyle.legendposition)', }," #Title if ($ChartObject.Title -ne '') { $cjsOptions += " title: { display: true, text: '$($ChartObject.Title)' }," } #Scales $cjsOptions += "scales: { yAxes: [{ stacked: $($ChartObject.ChartStyle.yAxesStacked), }] }," #Tooltips $cjsOptions += "tooltips: { mode: '$($ChartObject.ChartStyle.tooltips.mode)', intersect: $($ChartObject.ChartStyle.tooltips.intersect), }," #Hover $cjsOptions += "hover: { mode: '$($ChartObject.ChartStyle.hover.mode)', intersect: $($ChartObject.ChartStyle.hover.intersect), }," #animation $cjsOptions += " animation: { animateScale: $($ChartObject.ChartStyle.animateScale), animateRotate: $($ChartObject.ChartStyle.animateRotate), duration: 750, }," $cjsOptions += "}" $CJSOptions += "}); " $CJSFooter = " </script>" $CJS = @() $CJS += $CJSHeader $CJS += $CJSData $CJS += $CJSOptions $CJS += $CJSFooter write-output $CJS } #Endregion #Region Output Functions Function Save-HTMLReport { <# .SYNOPSIS generation of report and invokes the file to open .PARAMETER ReportName with generate a random file name if noone is specified .PARAMETER ReportPath specifiy test directory, will use %TEMP% by default .PARAMETER ReportContent This should be the complete HTML code #> [CmdletBinding()] Param ( [Parameter(Mandatory=$false)] [string]$ReportName, [Parameter(Mandatory=$false)] [string]$ReportPath, [Parameter(Mandatory=$true)] [Array]$ReportContent, [Parameter(Mandatory=$false)] [switch]$ShowReport ) if ([string]::IsNullOrEmpty($ReportPath)) { Write-Warning "ReportPath parameter $ReportPath is empty,using Temp" $ReportPath = $env:temp } else { if ((Test-Path $ReportPath) -eq $false ) { Write-Warning "ReportPath parameter $ReportPath is not valid or can't be accessed,using Temp" $ReportPath = $env:temp } } $ReportName = $ReportName.replace('.html','') if ($ReportName -eq $null -or $ReportName -eq ""){ $ReportName = -join ((65..90) + (97..122) | Get-Random -Count 12 | ForEach-Object {[char]$_}) } $rptFile = join-path $ReportPath ($ReportName.replace(" ","") + ".html") Write-Verbose "Generating Report File at $rptFile" $ReportContent | Set-Content -Path $rptFile -Force Write-Verbose $rptFile if ($ShowReport) { Start-Sleep -Seconds 1 Invoke-Item $rptFile } Write-Output $rptFile } Function Save-HTMLToBlobStorage { <# .SYNOPSIS generation of report and invokes the file to open #> [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [Array] $ReportContent, [Parameter(Mandatory=$true)] [string] $resourceGroupName = "", [Parameter(Mandatory=$true)] [string] $storageAccountName = "", [Parameter(Mandatory=$true)] [string] $storageContainerName = "", [Parameter(Mandatory=$false)] [string] $ReportPrefix = "HTMLReport" ) $localFileName ="{0}\report.html" -f $env:TEMP $ReportContent | Set-Content -Path $localFileName $blobFileName = $ReportPrefix + "-{0}" -f [guid]::NewGuid() + ".html" Write-Output ("Saving the report to storage") Write-Output ("Resource Group: {0}" -f $resourceGroupName) Write-Output ("Storage Account: {0}" -f $storageAccountName) Write-Output ("Storage Container: {0}" -f $storageContainerName) Write-Output ("Blob: {0}" -f $blobFileName) Set-AzureRmCurrentStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName | Out-Null $storageAccount = Get-AzureRmStorageAccount ` -ResourceGroupName $resourceGroupName ` -Name $storageAccountName $storageAccountContainer = Get-AzureStorageContainer ` -Name $storageContainerName $blob = Set-AzureStorageBlobContent ` -Container $storageContainerName ` -Blob $blobFileName ` -File $localFileName Write-Output ("Click the link below to view the report") $url = "https://{0}.blob.core.windows.net/{1}/{2}" -f $storageAccountName, $storageContainerName, $blob.Name $hash = @{ type = "hyperlink"; name = "Report: {0}" -f $blob.Name; value = $url } Write-Output($hash) } function Send-HTMLReport { <# .SYNOPSIS rudimentary send report via email function. Suggest finding more comprehensive function it must already exist :) .PARAMETER To .PARAMETER From .PARAMETER SMTPServer .PARAMETER SMTPPort #> [CmdletBinding()] Param ( [string]$ReportName, [string]$To, [string]$From, [string]$SMTPServer = "smtp.gmail.com", [string]$SMTPPort = "587", [string]$Body = 'HTML Report Attached', $Rptfile, [System.Management.Automation.PSCredential] $Credentials, [hashtable] $StoredReport ) Write-Warning "...this is in development, mainly as a placeholder. Expect Breaking changes." sleep 3 Send-MailMessage -From $From -to $To -Subject $ReportName ` -Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl -Credential $Credentials -Attachments $Rptfile } #Endregion #region Alias's New-Alias -name Get-HTMLPageClose -value Get-HTMLClosePage -Force New-Alias -name Get-HTMLPageOpen -value Get-HTMLOpenPage -force #endregion |