Skip to content

About

PowerShell Demo Content for Training and Testing

Resources

Stars

2 stars

Watchers

2 watching

Forks

Latest commit

 

History

37 Commits

Folders and files

Repository files navigation

PowerShell Training Demos

A curated collection of demo PowerShell (.ps1) scripts designed for teaching, live demonstrations, and team training sessions on core and advanced PowerShell concepts.


🧭 Recommended Learning Path

Level Topic Description & Key Concepts Demo File
01 - Foundations Editor Setup VS Code extensions, recommended settings, formatting, and snippets. Misc/VSCode_GettingStarted.ps1
PSCustomObjects Object creation ([PSCustomObject]), adding properties, cloning with .Copy(), ScriptMethods, and formatting files (.format.ps1xml). CommonTechniques/PSCustomObjects.ps1
Splatting Cleaner code syntax with named parameter hashtables (@hashtable), dynamic parameter assembly, and array splatting (@array). CommonTechniques/Splatting.ps1
Switch Statements Matching single/multiple values, wildcards, regex, script blocks, array looping, and control flow with continue. CommonTechniques/Switches.ps1
02 - Functions Function Basics Basic vs. Advanced functions, naming conventions, parameter validation, comment-based help, and Begin/Process/End blocks. PSFunctions/FunctionBasics.ps1
Bound Parameters Using $PSBoundParameters to inspect user-provided arguments vs. defaults, avoiding variable collisions, and conditional logic. PSFunctions/PSBoundParameters.ps1
Parameter Sets Creating mutually exclusive parameter sets and using $PSCmdlet.ParameterSetName to route execution logic. PSFunctions/PSCmdlet_ParameterSetName.ps1
ShouldProcess Implementing -WhatIf and -Confirm safety mechanisms using SupportsShouldProcess and ConfirmImpact. PSFunctions/PSCmdlet_ShouldProcess.ps1
03 - Error Handling Error Fundamentals $ErrorActionPreference, terminating vs. non-terminating errors, and try/catch/finally. ErrorHandling/Error_Demo1.ps1
Error Inspection & Types Inspecting $Error, catching specific .NET exception types, re-throwing errors, and custom error records. ErrorHandling/Error_Demo2.ps1
Silencing & .NET Errors Silencing with -ErrorAction Ignore, handling terminating .NET exceptions vs. boolean return-code methods (TryParse). ErrorHandling/Error_Demo3.ps1
Scheduled Tasks & Exit Codes Returning accurate exit codes from PowerShell for Windows Task Scheduler and automation monitoring tools. ErrorHandling/Error_Demo4.ps1

🎯 How to Use These Demos

  1. Interactive / Line-by-Line Execution: These files are designed to be run section-by-section in an interactive terminal or with VS Code (select lines and press F8).
  2. Compatibility:
    • Demos run on Windows PowerShell 5.1 and modern cross-platform PowerShell 7+.
    • Note: Windows-specific demos (e.g., Scheduled Tasks, Windows ACLs) require a Windows environment.

About

PowerShell Demo Content for Training and Testing

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages