20

Building Modules

A module groups a set of commands together, most often around a common system, service, or purpose. Modules were introduced with PowerShell 2.

A module written in PowerShell can contain functions, classes, enumerations, and DSC resources, and it may define aliases and include variables to include in the global scope.

There are several different common styles or layouts used when authoring modules. This chapter explores these different approaches, starting with the simplest.

This chapter explores the following topics:

  • Creating a module
  • Publishing a module
  • Multi-file module layout
  • Module scope
  • Initializing and removing modules

Technical requirements

This chapter uses the following modules, which can be installed from the ...

Get Mastering PowerShell Scripting - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.