Private/New-HtmlCleanupReport.ps1
function New-HtmlCleanupReport { [CmdletBinding()] param( [string] $Date = (Get-Date -Format 'yyyy/MM/dd HH:mm'), [string] $UserName = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name.ToLower(), [string] $Server = [System.Net.Dns]::GetHostEntry($env:ComputerName).HostName ) process { $script:ScriptSummary = @" <table style="width:100%"> <tr> <th>Total run time</th> <td>$script:TotalSeconds / $script:TotalMinutes</td> </tr> <tr> <th>Free space before</th> <td>$script:SpaceBefore</td> </tr> <tr> <th>Free space after</th> <td>$script:SpaceAfter</td> </tr> <tr> <th>TOTAL space cleaned</th> <td>$script:TotalCleaned</td> </tr> </table> "@ # CSS for the output table... [string] $css = @' <style> html body { font-family: Verdana, Geneva, sans-serif; font-size: 12px; height: 100%; margin: 0; overflow: auto; } #header { background: #481818; color: #ffffff; width: 100% } #headerTop { padding: 10px; } .logo1 { float: left; font-size: 25px; font-weight: bold; padding: 0 7px 0 0; } .logo2 { float: left; font-size: 25px; } .logo3 { float: right; font-size: 12px; text-align: right; } .headerRow1 { background: #481818; height: 5px; } .serverRow { background: #000000; color: #ffffff; font-size: 32px; padding: 10px; text-align: center; text-transform: uppercase; } .breakdownRow { background: #000000; color: #ffffff; font-size: 32px; padding: 10px; text-align: center; text-transform: uppercase; } .sectionRow { background: #481818; color: #ffffff; font-size: 13px; padding: 1px 5px!important; font-weight: bold; height: 15px!important; } table { background: #eaebec; border: #cccccc 1px solid; border-collapse: collapse; margin: 0; width: 100%; } table th { background: #ededed; border-top: 1px solid #fafafa; border-bottom: 1px solid #e0e0e0; border-left: 1px solid #e0e0e0; height: 45px; min-width: 55px; padding: 0px 15px; text-transform: capitalize; } table tr { text-align: center; } table td { background: #fafafa; border-top: 1px solid #ffffff; border-bottom: 1px solid #e0e0e0; border-left: 1px solid #e0e0e0; height: 55px; min-width: 55px; padding: 0px 10px; } table td:first-child { min-width: 175px; text-align: left; } table tr:last-child td { border-bottom: 0; } table tr:hover td { background: #f2f2f2; } table tr:hover td.sectionRow { background: #481818; } </style> '@ # Page header rows... [string] $body = @" <div id="header"> <div id="headerTop"> <div class="logo1">UC</div> <div class="logo2">RDS Cleanup report: $Server</div> <div class="logo3"> <br/>Generated by $UserName on $Date</div> <div style="clear:both;"></div> </div> <div style="clear:both;"></div> </div> <div class="headerRow1"></div> <div class="serverRow">SUMMARY</div> <div class="headerRow1"></div> <div class="headerRow1"></div> <div>$script:ScriptSummary</div> <div class="headerRow1"></div> <div class="breakdownRow">SECTION BREAKDOWN</div> "@ $Html = $script:CleanupReport.Values | ConvertTo-Html -Head $css -Body $body | Out-String return $Html } } |