Core Skills
Chapter 6 of 18
Chapter 6: Toolboxes You Can Load When You Need Them
Think of modules as toolboxes that PowerShell can open when you need them. Instead of loading every command at once, PowerShell keeps related commands together in a module, and you load just the toolbox for the job in front of you. That keeps things fast, tidy, and easier to understand. You will learn how to see which modules are installed, which ones are already loaded, and how to import the one you need. By the end of this chapter, you will also be able to build a small module of your own, so your favourite functions are ready to reuse instead of being copied from place to place.
2 lessons 3 learning objectives 2 related commands
Topics at a glance: What is a module, Import a module and build a custom module.
Where this chapter fits
This chapter comes after Chapter 5: Turn Commands Into Scripts You Can Reuse in the journey, so ideas from that chapter will feel familiar here.
After this chapter comes Chapter 7: One Way to Explore Every Store.
Learning objectives
By the end of this chapter, you will be able to:
- Explain what a module is
- List and inspect installed modules
- Import a module and build a simple custom module
Lessons in this chapter
Work through the lessons in order. Each lesson page has explanations, examples, common mistakes, and a knowledge check.
Lesson 1: What is a module
A module bundles related commands together. Instead of loading every command at startup, PowerShell loads modules on demand, which keeps startup fast and the command list manageable.
3 things to learn in this lesson
Lesson 2: Import a module and build a custom module
Import-Module loads a module into your session. A custom module is simply your own functions saved in a .psm1 file, with a manifest that describes them.
3 things to learn in this lesson
Related command references
These command pages are linked to lessons in this chapter. Each command page has its syntax, parameters, and examples.
Get-Module
Lists loaded modules, or, with ListAvailable, installed modules.
From the lesson: What is a module
Import-Module
Loads a module into the current session.
From the lesson: Import a module and build a custom module
Tip: read the lesson first, then use the command page as a quick reference.