Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jdhitsolutions/psteachingtools
:mortar_board: A set of commands and tools for teaching PowerShell. The module should work in Windows PowerShell, PowerShell 7.x and run cross-platform.
https://github.com/jdhitsolutions/psteachingtools
powershell teaching-powershell
Last synced: about 1 month ago
JSON representation
:mortar_board: A set of commands and tools for teaching PowerShell. The module should work in Windows PowerShell, PowerShell 7.x and run cross-platform.
- Host: GitHub
- URL: https://github.com/jdhitsolutions/psteachingtools
- Owner: jdhitsolutions
- License: mit
- Created: 2016-08-01T23:50:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-04T20:29:42.000Z (4 months ago)
- Last Synced: 2024-10-12T21:06:45.685Z (2 months ago)
- Topics: powershell, teaching-powershell
- Language: PowerShell
- Homepage:
- Size: 228 KB
- Stars: 48
- Watchers: 9
- Forks: 22
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README
# PSTeachingTools
[![PSGallery Version](https://img.shields.io/powershellgallery/v/PSTeachingTools.png?style=for-the-badge&label=PowerShell%20Gallery)](https://www.powershellgallery.com/packages/PSTeachingTools/) [![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/PSTeachingTools.png?style=for-the-badge&label=Downloads)](https://www.powershellgallery.com/packages/PSTeachingTools/)
## Installation
Install this module from the PowerShell Gallery:
```powershell
Install-Module PSTeachingTools [-scope AllUsers]
```*Do not attempt to download and install from this repository unless you are an experienced PowerShell user.* Install the module from the PowerShell Gallery as shown above.
The module should work in both Windows PowerShell and PowerShell 7, including cross-platform. Please post an issue with any feedback, suggestions, or problems.
## :teacher: Teaching PowerShell
This PowerShell module includes tools and techniques for teaching PowerShell. Many of the commands will create a set of sample objects and commands that can be used to demonstrate a variety of PowerShell techniques and concepts without having to worry about anything technical like Active Directory, services, or file objects.
- [Get-Vegetable](docs/Get-Vegetable.md)
- [Set-Vegetable](docs/Set-Vegetable.md)
- [Remove-Vegetable](docs/Remove-Vegetable.md)
- [New-Vegetable](docs/New-Vegetable.md)Once the module is imported, you can use these commands like any other PowerShell command.
![Using objects in the pipeline](assets/get-vegetable.jpg)
![setting objects](assets/set-vegetable.jpg)
Beginning in v4.0.0 of this module, the custom vegetable objects are exposed as publicly-defined objects with a variety of properties and methods. Some of the properties are read-only. Associated enumerations are also now publicly available.
```powershell
PS C:\> Get-Vegetable Corn | Get-MemberTypeName: PSTeachingTools.PSVegetable
Name MemberType Definition
---- ---------- ----------
State AliasProperty State = CookedState
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
Peel Method void Peel()
Prepare Method void Prepare(PSTeachingTools.VegStatus State)
ToString Method string ToString()
Color Property PSTeachingTools.VegColor Color {get;}
CookedState Property PSTeachingTools.VegStatus CookedState {get;set;}
Count Property int Count {get;set;}
IsPeeled Property bool IsPeeled {get;set;}
IsRoot Property bool IsRoot {get;}
Name Property string Name {get;}
UPC Property int UPC {get;}PS C:\> [PSTeachingTools.VegStatus]::Sauteed
Sauteed
```The `PSVegetable` object has a custom format file with defined table views.
```powershell
PS C:\> Get-FormatView PSTeachingTools.PSVegetableType: PSTeachingTools.PSVegetable
Format Name
------ ----
Table default
Table State
Table color
```This means you can run a command like:
```powershell
PS C:\> Get-Vegetable | Format-Table -View color
```The `Color` view relies on ANSI values stored in the `$AnsiVegColor` hashtable.
The primary idea behind these commands is that you can use them to teach core PowerShell concepts and techniques. Once the student understands how vegetable objects work in the pipeline, it is a small step to files, processes, and services.
See the [about_PSTeachingTools](docs/about_PSTeachingTools.md) help file for more information.
## :robot: Typed Demos
The module also includes a function for simulating an interactive PowerShell console session. You can type your commands in a file and have the function "play back" the commands just as if you were typing the commands. The function will pause after every `|` character. Pressing `Enter` will advance the demo. The commands from the demo file will also be added to the session's command history.
### Live Commands
Starting in v4.1.0, you can insert `` into your demo file. When `Start-TypedDemo` reaches this line, it will let you enter a live command. Enter a command carefully and without error. Backspaces will break this step. Due to timing, the first key stroke may not be detected. This feature should be considered *experimental*.
Read command help for [Start-TypedDemo](docs/Start-TypedDemo.md). A [sample file](samples/sampledemo.txt) is included in this module.
Learn more about PowerShell: [http://jdhitsolutions.com/blog/essential-powershell-resources/](http://jdhitsolutions.com/blog/essential-powershell-resources/)
## Sponsorship
If you find this module helpful or valuable, especially if used in a commercial setting, a small token of sponsorship would be deeply appreciated.