Skip to content

DojCivil/PowerShell-HTML-Report

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

PowerShell

PowerShell Automation

Description

This is a function that will assist with creating HTML/CSS style reports from powershell. This script provides a more modern report than traditional text output and will email the report as an attachment once generated. This specific report targets a specific AD group's members; however, this can be revised to fit your business requirements. You can extend the functionality to create more complex reports and modify the HTML/CSS formatting to create a custom look.

Examples

After the function has been loaded into memory
Type: GenerateHTMLReport

If you want to run fully automate the report as a scheduled task, you will need to call the fucnction at very bottom of the script by typing GenerateHTMLReport. Example:

$sorted = $customerArray | sort department
$htmSorted = $sorted | ConvertTo-Html -Fragment -Property Name, Department 

#------------- Convert the report to HTML File format and email as attachement ------------------------

ConvertTo-Html -Head $vCSS -Title $vTitle -Body "<h1> $vTitle </h1> `n <h5> This Report Was Generated on $date </h5>  `n $htmSorted " | Out-File $vReport

#Send-MailMessage -SmtpServer $smtpServer -Subject $vSubject -From $vFrom -To "$toEmail" -Body $vBody -Attachments $reportPath -BodyAsHtml -Priority High

#--- Auto Launch Report ----------
Invoke-Item $vReport

}

GenerateHTMLReport

Meta Data

Author: Department of Justice Civil Division
MIT License Information

About

PowerShell Automation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published