Scripting and Toolmaking

Session Detail:    Classroom, Virtual 5 Day

Covers advanced Windows PowerShell topics, with an emphasis on building reusable tools. Introduces workflow, reinforces best practices, and teaches a variety of script development and tool making techniques.

Prerequisites

  • Experience at basic Windows administration
  • Experience using Windows PowerShell to query and modify system information
  • Experience using Windows PowerShell to discover commands and their usage
  • Experience using WMI and/or CIM to query system information

Who Can Benefit

This course is intended for administrators in a Microsoft-centric environment who want to build reusable units of automation, automate business processes, and enable less-technical colleagues to accomplish administrative tasks.

Session Outline

Class Outline

Module 1: Tool Design

  • Lesson 1: Tools do one thing
  • Lesson 2: Tools are flexible
  • Lesson 3: Tools look native

After completing this module, students will be able to:

  • Describe the native shell patterns that a good tool design should exhibit

Module 2: Start with a Command

  • Lesson 1: Why start with a command?
  • Lesson 2: Discovery and experimentation

After completing this module, students will be able to:

  • Describe the benefits of discovery and experimentation in the console
  • Discover and experiment with existing commands in the console

Module 3: Build a Basic Function and Module

  • Lesson 1: Start with a basic function
  • Lesson 2: Create a script module
  • Lesson 3: Check prerequisites
  • Lesson 4: Run the new command

After completing this module, students will be able to:

  • Build a basic function
  • Create a script module
  • Run a command from a script module

Module 4: Adding CmdletBinding and Parameterizing

  • Lesson 1: About CmdletBinding and common parameters
  • Lesson 2: Accepting pipeline input
  • Lesson 3: Mandatory-ness
  • Lesson 4: Parameter validation
  • Lesson 5: Parameter aliases

After completing this module, students will be able to:

  • Describe the purpose of CmdletBinding and list common parameters
  • Parameterize a scripts input
  • Define parameters as mandatory
  • Define parameters as accepting pipeline input
  • Define parameter validation

Module 5: Emitting Objects as Output

 

  • Lesson 1: Assembling information
  • Lesson 2: Constructing and emitting output
  • Lesson 3: Quick tests

After completing this module, students will be able to:

  • Describe the purpose of object-based output
  • Create and output custom objects from a function

 

Module 6: An Interlude: Changing Your Approach

  • Lesson 1: Examining a script
  • Lesson 2: Critiquing a script
  • Lesson 3: Revising the script

After completing this module, students will be able to:

  • Describe the native patterns that a good tool design should exhibit
  • Redesign a script to meet business requirements and conform to native patterns

Module 7: Using Verbose, Warning, and Informational Output

  • Lesson 1: Knowing the six channels
  • Lesson 2: Adding verbose and warning output
  • Lesson 3: Doing more with verbose output
  • Lesson 4: Informational output

After completing this module, students will be able to:

  • Describe the six output channels in the shell
  • Write commands that use verbose, warning, and informational output
  • Run commands with extra output enabled

Module 8: Comment-Based Help

  • Lesson 1: Where to put your help
  • Lesson 2: Getting started
  • Lesson 3: Going further with comment-based help
  • Lesson 4: Broken help

After completing this module, students will be able to:

  • Describe the purpose and construction of comment-based help
  • Add comment-based help to a function
  • Identify causes of broken comment-based help

Module 9: Handling Errors

  • Lesson 1: Understanding errors and exceptions
  • Lesson 2: Bad handling
  • Lesson 3: Two reasons for exception handling
  • Lesson 4: Handling exceptions in our tool
  • Lesson 5: Capturing the actual exception
  • Lesson 6: Handling exceptions for non-commands
  • Lesson 7: Going further with exception handling
  • Lesson 8: Deprecated exception handling

After completing this module, students will be able to:

  • Describe the native patterns for handling errors in a command
  • Add error handling to a command
  • Run a command and observe error handling behaviors

Module 10: Basic Debugging

  • Lesson 1: Two kinds of bugs
  • Lesson 2: The ultimate goal of debugging
  • Lesson 3: Developing assumptions
  • Lesson 4: Write-Debug
  • Lesson 5: Set-PSBreakpoint
  • Lesson 6: The PowerShell ISE

After completing this module, students will be able to:

  • Describe the tools used for debugging in PowerShell
  • Debug a broken script

Module 11: Going Deeper with Parameters

  • Lesson 1: Parameter positions
  • Lesson 2: Validation
  • Lesson 3: Multiple parameter sets
  • Lesson 4: Value from remaining arguments
  • Lesson 5: Help messages
  • Lesson 6: Aliases
  • Lesson 7: More CmdletBinding

After completing this module, students will be able to:

  • Describe the use of positional parameters
  • Describe additional parameter validation methods
  • Describe how to define multiple parameter sets
  • Describe other parameter definition options

Module 12: Writing Full Help

  • Lesson 1: External help
  • Lesson 2: Using PlatyPs
  • Lesson 3: Supporting online help
  • Lesson 4: About topics
  • Lesson 5: Making your help updatable

After completing this module, students will be able to:

  • Describe the advantages of external help
  • Create external help using PlatyPS and Markdown

Module 13: Unit Testing Your Code

  • Lesson 1: Sketching out the test
  • Lesson 2: Making something to test
  • Lesson 3: Expanding the test
  • Lesson 4: Going further with Pester

After completing this module, students will be able to:

  • Describe the purpose of unit testing
  • Write basic unit tests for PowerShell functions

Module 14: Extending Output Types

  • Lesson 1: Understanding types
  • Lesson 2: The Extensible Type System
  • Lesson 3: Extending an object
  • Lesson 4: Using Update-TypeData

After completing this module, students will be able to:

  • Describe the purpose of the ETS
  • Extend an existing object type

Module 15: Analyzing Your Script

 

  • Lesson 1: Performing a basic analysis
  • Lesson 2: Analyzing the analysis

After completing this module, students will be able to:

  • Describe the use of Script Analyzer
  • Perform a basic script analysis

 

Module 16: Publishing Your Tools

  • Lesson 1: Begin with a manifest
  • Lesson 2: Publishing to PowerShell Gallery
  • Lesson 3: Publishing to private repositories

After completing this module, students will be able to:

  • Describe the tool publishing process and requirements
  • Publish a tool to a repository

Module 17: Basic Controllers: Automation Scripts and Menus

  • Lesson 1: Building a menu
  • Lesson 2: Using UIChoice
  • Lesson 3: Writing a process controller

After completing this module, students will be able to:

  • Describe the purpose of basic controller scripts
  • Write a simple controller script

Module 18: Proxy Functions

  • Lesson 1: A proxy example
  • Lesson 2: Creating the proxy base
  • Lesson 3: Modifying the proxy
  • Lesson 4: Adding or removing parameters

After completing this module, students will be able to:

  • Describe the purpose of proxy functions
  • Create a simple proxy function

Module 19: Working with XML Data

  • Lesson 1: Simple: CliXML
  • Lesson 2: Importing native XML
  • Lesson 3: ConvertTo-XML
  • Lesson 4: Creating native XML from scratch

After completing this module, students will be able to:

  • Describe the use of XML within PowerShell
  • Use XML data within a PowerShell function

Module 20: Working with JSON Data

  • Lesson 1: Converting to JSON
  • Lesson 2: Converting from JSON

After completing this module, students will be able to:

  • Describe the use of JSON data within PowerShell
  • Use JSON data within a PowerShell function

Module 21: Working with SQL Server Data

  • Lesson 1: SQL Server terminology and facts
  • Lesson 2: Connecting to the server and database
  • Lesson 3: Writing a query
  • Lesson 4: Running a query
  • Lesson 5: Invoke-SqlCmd
  • Lesson 6: Thinking about tool design patterns

After completing this module, students will be able to:

  • Describe the use of SQL Server from within PowerShell
  • Write and run SQL Server queries
  • Design tools that use SQL Server for data storage

Module 22: Final Exam

  • Lesson 1: Lab problem
  • Lesson 2: Break down the problem
  • Lesson 3: Do the design
  • Lesson 4: Test the commands
  • Lesson 5: Code the tool

After completing this module, students will be able to:

  • Create PowerShell tools, using native design patterns, from business requirements

Need to train your team?

All of our sessions can be customized to meet your team’s specific need. Build the perfect program by picking and choosing topics from any of the courses in our catalog. A personalized private session gives you the ultimate flexibility and helps maximize your team’s valuable time!

Requesting Team Training
DateTimeTypePriceAdd To Cart

Scripting and Toolmaking

5 Day
Classroom, Virtual

$3,095.00

Chat with a Coach

Chat with a Coach

Have a more immediate need? Why spend the next hour searching online for answers when you can spend just 15 minutes with one of our experts and get accurate and personalized answers to all of your questions. 

$9.99 | 15 Minutes

Book Now