0
0
PowerShellscripting~30 mins

Report generation automation in PowerShell - Mini Project: Build & Apply

Choose your learning style9 modes available
Report generation automation
📖 Scenario: You work in an office where you need to create a simple report of sales data every day. The sales data is stored in a list, and you want to automate making a summary report that shows only sales above a certain amount.
🎯 Goal: Build a PowerShell script that creates a sales data list, sets a sales threshold, filters the sales above that threshold, and then prints the filtered report.
📋 What You'll Learn
Create a list of sales with exact values
Set a sales threshold variable
Filter sales above the threshold using a loop or pipeline
Print the filtered sales report
💡 Why This Matters
🌍 Real World
Automating report generation saves time and reduces errors when working with daily sales or other data.
💼 Career
Many jobs require automating data filtering and reporting using scripts like PowerShell to improve productivity.
Progress0 / 4 steps
1
Create the sales data list
Create a list called $sales with these exact values: 120, 75, 200, 50, 300
PowerShell
Need a hint?

Use @( ... ) to create an array in PowerShell.

2
Set the sales threshold
Create a variable called $threshold and set it to 100
PowerShell
Need a hint?

Just assign the number 100 to the variable $threshold.

3
Filter sales above the threshold
Create a new list called $filteredSales that contains only the sales from $sales which are greater than $threshold. Use the Where-Object cmdlet with a script block that uses $_ -gt $threshold.
PowerShell
Need a hint?

Use the pipeline | and Where-Object to filter the list.

4
Print the filtered sales report
Print the text "Filtered sales above threshold:" and then print the $filteredSales list on the next line.
PowerShell
Need a hint?

Use Write-Output to print text and variables.