Create an HTML Report
Knowing how to use scripts to generate easy-to-read system reports is a key responsibility of system administrators. This IT Pro Challenge virtual lab will teach you how to create HTML reports. HTML reports allow non-technical users to view system reports. After completing this lab, you will feel confident in generating custom HTML reports.
Windows PowerShell is a task-based command-line shell and scripting language. PowerShell is different from the normal command prompt, because PowerShell uses different commands, called cmdlets, and was designed specifically for system administrators. To be efficient as a Windows system administrator, you will need to know how to create a custom module on Windows and how to write and run modules in the Windows PowerShell.
PowerShell allows system administrators to compile system reports. These reports can include a wealth of information about the computers on a network, such as the current processes running on a system. However, the reports PowerShell generates are often hard to read. One way around the default formatting of cmdlets is to pipe their output to HTML. By displaying reports in HTML, you will be able to summarize and convey your PowerShell outputs to a broader user base of varying technical skill.
To compile reports using PowerShell effectively, you will need to design an HTML page for reports display. This hands-on lab will give you important experience creating HTML reports.
Understand the scenario: You are a system administrator for your organization. You have been generating text-based reports for upper-level executives by using Windows PowerShell. They find these reports difficult to read due to the volume of information being presented. You need to make these reports easier to read by converting them into HTML.
Understand the environment: You are using an Azure resource group that contains an Azure virtual machine.
Configure your environment:
To begin this virtual lab, you will first prepare your resources. You will:
- Sign in to the Azure portal using given credentials.
- Connect to an Azure virtual machine (VM).
- Launch the Windows PowerShell.
Write a script to output running services as HTML:
The first step of this virtual lab is to create a basic script for outputting reports in HTML format. You will:
- Create a Windows PowerShell script to output the running processes on a given computer.
- Add a loop to create reports for multiple computers.
- Pipe the output of the Get-Service cmdlet to HTML format for each computer.
- Test your script.
Add more output to the same HTML file:
For the next step, you will customize the output HTML file. You will:
- Add a header to the report.
- Modify the ConvertTo-HTML cmdlet to append the reports output to a file.
- Modify the script to output the top 10 running processes by the highest working set.
- Add a new command to the script to retrieve the volume information.
Add CSS code to the report:
For the final step of this challenge, you will add CSS code to your report. You will:
- Create a CSS style file.
- Link the script output to the CSS file.
- Embed the CSS code in a style tag inside the HTML report file.
PowerShell scripts allow users to execute complex tasks easily through programmed sequences of PowerShell commands. PowerShell modules can be used to generate several kinds of reports. However, these reports are often hard to read. To generate easy-to-understand reports for system users, system administrators can output report data in HTML format. PowerShell scripts may be used to generate reports and output them to custom HTML files. This virtual lab will give you real-world experience generating reports with PowerShell, displaying reports in HTML format, and creating custom HTML file formats with CSS.
In the “Create an HTML Report” virtual lab, you will accomplish the following:
- Connect to a Windows virtual machine hosted in Azure.
- Create a PowerShell script to output reports to an HTML file.
- Add CSS code to the HTML report.
This “Getting Started with Advanced PowerShell” IT Pro Challenge virtual lab teaches learners to create ...
Prove your capabilities as an exceptionally skilled enterprise professional and work hands- on using Microsoft ...