Toolmaking with PowerShell
You build versioned, documented tools your team will use every day, using classes, .NET, parallel jobs and binary modules.
Level 501 · 13 lessons · 12 practice labs
Lessons
Language depth
- Classes and enums
- Using .NET types directly
- ForEach-Object -Parallel and runspaces
- Working with REST APIs: Invoke-RestMethod
- Error records and logging inside a tool
- Short task: write a function that checks a hundred servers in parallel
Making it a product
- Module layout and a build script
- Generating help documentation automatically
- Versioning, a changelog and an internal repository
- The same tool on Windows and Linux
- Measuring and improving a tool’s speed
- Short task: version your module and publish it to the internal repository
Wrap-up
- Capstone: write and publish an end-to-end admin tool for the team
Practice labs
- A ticket class with an enum status: Write a class for a support ticket with a status enum and validation, and show an invalid status assignment errors and the object converts to readable text.
- Sort IP addresses properly: Put an IP address list that sorts wrongly as text into numeric order using .NET types, remove duplicates and move invalid addresses to a separate list.
- Objects that sort and display well: Make a version-number class comparable so Sort-Object orders it correctly, and add a custom format view that shows only chosen columns in a table.
- A total from a paged API: Walk the lab’s local inventory API page by page with Invoke-RestMethod, collect every record and report counts by status.
- Results that go missing in parallel: Fix a script that loses results in a parallel loop using proper outer-variable access and a thread-safe collection, add a throttle limit and show the result count equals the input count.
- An API that rate-limits and expires your session: Write a parallel client that retries with growing waits on rate-limit errors and refreshes an expired token, and prove every record is fetched completely and without duplicates.
- A loop that slows as it grows: Rewrite the loop that slows down because it appends to an array each turn using a suitable collection, and compare before/after times with Measure-Command.
- Proper logging for a tool: Add levelled logging to the tool that writes one JSON object per line, and show error records land in the log with their details while verbose streams appear only on request.
- A tool that must get ten times faster: Find by measurement the three bottlenecks in Demirhan Machinery’s report tool (filtering inside a loop, repeated file reads, string concatenation), remove them without changing the output and prove the target speed-up.
- Turn help into documents: Generate a document page per command from the module’s comment-based help, find the commands missing examples and complete them.
- A module built with one command: Write a build script that merges function files into one module file, bumps the manifest version, updates the changelog and places the output in a folder only if the tests pass.
- A tool that fails on Linux: Make a tool that breaks on Linux because of path separators, case sensitivity and Windows-only commands work on both systems, and publish it to the internal repository as a prerelease.
About this course
You build versioned, documented tools your team will use every day, using classes, .NET, parallel jobs and binary modules.
What you will learn
- Language depth
- Making it a product
- Wrap-up
Prerequisites
You should be experienced in the topics of the same path up to level 401.
Lab environment
Lessons run in your own Kali Linux terminal that opens in the browser. Nothing to install; the lab starts clean in every lesson.
Frequently asked questions
- Is this course right for my level?
- The course is at level 501; it assumes you know the topics of the lower-level courses.
- Is there anything to install?
- No. Every lesson runs in your own lab environment that opens in the browser.
- How do lessons work?
- Each lesson has 8 to 10 steps and a short quiz. Early steps show the command to type, later steps give less help; if two attempts fail, the solution opens.
- Can I try it for free?
- Yes. The first three lessons of every course are free.