Actually System Admins do a lot stuff with Powershell Scripts. Often in Powershell you get lists where data is collected in table format.ย All Tech/non Tech peoples loves a nice HTML report for reviewing. Creating these type of reports in PowerShell is very easy and simple with Powershell . These type of nice HTML reports can be generate with the help ConvertTo-HTML cmdlet.ย  Converts Microsoft .NET Framework objects into HTML that can be displayed in a Web browser. The Powershell based Reports are easy to createย  and you also can create a unique .css file to make the design for all reports identically to impress with reports.

In my previous article i had posted the article which helps to create single HTLML report. Here i going to deep drive about how to populate multiple reports in single HTML format.

Create CSS File

Here i had wrote the required CSS code for the report and placed the below code in notepad and saved with the name C:\dotnet-helpers\Logreport.css. If required you can create two separate .css file and design your reports based on your requirements.ย 

In the below script, I had creating two separate variable to assign the Application and System Event logs ( $applicationLog ,$systemLog). Here you can get detail post about the Event log, so refer if required more details on it.

Then you can refer the stylesheet from an external CSS file with help of -CssUri parameter (-CssUri โ€˜C:\dotnet-helpers_com\Logreport.cssโ€™) and generate the HTML report in the destination location. The CSSย  file will applied to the HTML element during the execution and generate the report.

OUTPUT