🎓 A1Learner
🔍
0 of 52 lessons completed

PowerShell Project: System Report

A system report is a short summary of fixed facts about a setup. It gathers values into one readable list.

A fixed report date

Get-Date with a fixed date literal gives the same date on every run. The report prints that date as a label and a value.

$reportDate = Get-Date -Date "2026-10-28" -Format "yyyy-MM-dd"
"Report date: $reportDate"

The PowerShell version

PSVersionTable holds facts about the running PowerShell. Its version prints as one short value.

$version = $PSVersionTable.PSVersion.ToString()
"PowerShell version: $version"

A total from a list of scores

Measure-Object with -Sum adds a list of numbers. The report prints only the Sum value.

$scores = 9, 8, 10
$total = ($scores | Measure-Object -Sum).Sum
"Total score: $total"

Example

$reportDate = Get-Date -Date "2026-10-28" -Format "yyyy-MM-dd"
$version = $PSVersionTable.PSVersion.ToString()
$tools = "Editor", "Terminal", "Browser"
$scores = 9, 8, 10
$total = ($scores | Measure-Object -Sum).Sum
"Report date: $reportDate"
"PowerShell version: $version"
"Tools checked: $($tools.Count)"
"Total score: $total"

Key points

  • Report: a list of labelled values that describe a setup at a glance.
  • Fixed date: a fixed date literal keeps a report the same on every run.
  • Version: PSVersionTable holds version facts about the running PowerShell.
  • Count: an array Count tells how many items the report checked.
  • Total: Measure-Object with -Sum adds a list of numbers.

In this example, the script sets a fixed report date and reads the PowerShell version. It lists three tools and three scores. It adds the scores with Measure-Object. It prints four labelled lines, one value per line.

Note

a report prints values only, never whole objects or tables.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

Which value stays the same on every run of a system report?