FREE POWERSHELL AUTOMATION LEARNING PATH

WikiFree original practice workbook

The object pipeline

CASE STATUS: fictional/synthetic teaching material. Do not present the example as real research, employment experience or measured business performance.

OUTCOME
Write a PowerShell file-inventory script with parameters, extension summaries, a preview mode and clear error handling.

BEFORE YOU START
Basic folders and command-line use. PowerShell 7 available from an official source; no administrator privileges required for the practice folder.

CASE
The fictional Birch Records team wants a summary of a dedicated practice folder. The supplied UTF-8 fixture contains a.txt with alpha plus a newline (6 bytes), b.txt with beta plus a newline (5), one.csv with id/1 lines (5) and two.csv with id/2/3 lines (7). The script reads metadata and exports a separate summary; it does not rename or delete inputs.

INPUTS
Extension,Files,Total bytes
.txt,2,11
.csv,2,12


ENTRY CHECK

Question: Does PowerShell pass only plain text between commands?

Self-check: No. Its pipeline commonly carries objects.

Question: Should a file inventory modify source files?

Self-check: Not for this task.

Question: What must an unattended script do with errors?

Self-check: Report a clear failure rather than silently claiming success.

STAGE 1: Inspect file objects

Prerequisite: Basic folders and command-line use. PowerShell 7 available from an official source; no administrator privileges required for the practice folder.

Instruction: PowerShell commands can return objects with properties such as Name, Length and Extension. Inspect those properties before formatting output. Formatting commands are for display and should generally come after data processing. Work in the supplied practice folder so the exercise has a known input set and does not expose personal directory contents.

Practice task: List the four fixture files and inspect Name, Length and Extension. Record the difference between objects and their formatted display.

Deliverable: A file-object inspection note.

Acceptance check: The four lengths are 6, 5, 5 and 7 bytes in the supplied fixture.

If stuck: If line endings changed after recreating files, report the actual bytes and explain the difference.

Record your work, decisions and evidence:




Record your result against the acceptance check:



STAGE 2: Build a filtering and grouping pipeline

Prerequisite: Bring your previous output: A file-object inspection note.

Instruction: Filter to files, normalize extensions consistently and group the resulting objects. Count members and sum Length for each group. Keep the output as objects so it can be exported later. Decide explicitly whether subfolders are included; this first script inventories only the named folder, not a recursive tree.

Practice task: Build the extension summary and sort it by extension. Compare counts and byte totals to the fixture.

Deliverable: A two-row extension summary.

Acceptance check: Counts total 4 and lengths total 23 bytes for the unchanged fixture.

If stuck: Do not run Format-Table before Export-Csv, which can export formatting objects instead of your data.

Record your work, decisions and evidence:




Record your result against the acceptance check:



STAGE 3: Parameterize and validate the script

Prerequisite: Bring your previous output: A two-row extension summary.

Instruction: Parameters make a script reusable, but they also create new failure cases. Require an existing input directory and an output path outside that input folder for this exercise. Validate before processing, and keep the output schema stable. Clear names and help text are more useful than relying on the author current directory.

Practice task: Add InputPath and OutputPath parameters and reject a missing input folder or an output inside the fixture folder.

Deliverable: A parameterized inventory script.

Acceptance check: The script works from a different current directory and rejects invalid paths before exporting.

If stuck: Do not assume a relative path always resolves to the folder the reader expects.

Record your work, decisions and evidence:




Record your result against the acceptance check:



STAGE 4: Add preview and error behavior

Prerequisite: Bring your previous output: A parameterized inventory script.

Instruction: A preview mode should show intended output without writing it. Use PowerShell ShouldProcess support for the export action and handle expected file or path failures with clear messages. A catch block that prints an error but exits as if everything succeeded can mislead automation. Preserve source files and avoid broad cleanup commands.

Practice task: Run with WhatIf and verify no output file is created. Then test a valid export and a missing input path.

Deliverable: A preview mode and documented failure behavior.

Acceptance check: Preview writes nothing, valid export matches the schema and invalid input is reported clearly.

If stuck: Do not label a run successful merely because the script reached its final line.

Record your work, decisions and evidence:




Record your result against the acceptance check:



STAGE 5: Package a repeatable run

Prerequisite: Bring your previous output: A preview mode and documented failure behavior.

Instruction: Document the PowerShell version, command, input scope, output schema and known limitations. The byte expectations depend on the supplied files; regenerated platform-specific line endings can change lengths. Include the fixture and a manual verification checklist so another learner can distinguish a code error from changed input data.

Practice task: Write the README and rerun from a clean output location. Compare the exported rows with the fixture reference.

Deliverable: A script, fixture and verification handover.

Acceptance check: The report records the actual runtime and checks rather than assuming portability from syntax alone.

If stuck: Do not claim the script was executed on operating systems you did not test.

Record your work, decisions and evidence:




Record your result against the acceptance check:



WORKED CASE
For the supplied bytes, .txt has two files totaling 11 and .csv has two totaling 12. The total is four files and 23 bytes. Recreating the fixture with different newline encodings changes bytes, so preserve the downloaded files for the baseline check.

FINAL PROJECT
Deliver the script, unchanged fixture, expected summary, preview evidence, error-case notes and README. Add one new .txt file to a copy and show that only the corresponding count and byte sum change.

REQUIRED CRITICAL CHECK
The script does not alter input files, preview performs no export and invalid paths do not produce a false success.

SCORING
Score each of the five stage acceptance checks from 0–16 (0 missing/incorrect; 8 partially supported; 16 complete and evidenced). Score the final integrated project from 0–20 (0 missing; 10 incomplete handover; 20 complete, reproducible and consistent with the case). Target: at least 80/100 AND the critical check must pass. A total score never overrides a failed critical check.

SCOPE LIMIT
This is a local inventory automation, not remoting, infrastructure administration, credential handling or a complete DevOps pipeline.

SOURCES AND ACCESS
The public videos and PowerShell are free. Use an official installation and a dedicated practice folder. No cloud service, administrator session or private production data is needed.

PowerShell Master Class: Free Course
WikiFree: https://wikifree.com/courses/free-john-savill-powershell-master-class/
Official source: https://www.youtube.com/playlist?list=PLlVtbbG169nFq_hR7FcMYg32xsSAObuq8
Why selected: Selected public PowerShell lessons cover objects, pipelines, scripts, error handling, data and PowerShell 7. Remoting and configuration-management lessons are outside scope.

Stage 1 selected lessons:

1. PowerShell Master Class - PowerShell Fundamentals (1:14:50)
https://www.youtube.com/watch?v=sQm4zRvvX58&list=PLlVtbbG169nFq_hR7FcMYg32xsSAObuq8&index=1

Stage 2 selected lessons:

2. PowerShell Master Class - Connecting Commands Together (1:06:50)
https://www.youtube.com/watch?v=K_LsLq5yGgk&list=PLlVtbbG169nFq_hR7FcMYg32xsSAObuq8&index=2

Stage 3 selected lessons:

5. PowerShell Master Class - PowerShell Scripting (33:42)
https://www.youtube.com/watch?v=ApbdhcZBcyU&list=PLlVtbbG169nFq_hR7FcMYg32xsSAObuq8&index=5

Stage 4 selected lessons:

6. How to use PowerShell Try, Catch and the Write-Verbose and Write-Debug (19:23)
https://www.youtube.com/watch?v=2eByC9N1xIQ&list=PLlVtbbG169nFq_hR7FcMYg32xsSAObuq8&index=6

Stage 5 selected lessons:

9. PowerShell Master Class - Data and Objects (46:10)
https://www.youtube.com/watch?v=Bmsa6F69afA&list=PLlVtbbG169nFq_hR7FcMYg32xsSAObuq8&index=9

12. PowerShell 7 Overview (28:52)
https://www.youtube.com/watch?v=K9EUntTP7jM&list=PLlVtbbG169nFq_hR7FcMYg32xsSAObuq8&index=12

PowerShell official overview
https://learn.microsoft.com/en-us/powershell/scripting/overview

REUSE
Original WikiFree teaching text and synthetic fixtures are supplied for personal learning and adaptation with attribution. Provider lessons remain on their original sites and retain their own terms. No provider certificate is included.