Structured PowerShell code that is easy to share and use.
They can be imported with Import-Module or automatically if installed from The PowerShell Gallery.
Installed modules can be viewed with Get-module.
PowerShell Gallery
Is repository of modules curated by Microsoft.
One can interact with it by using the Cmdlet PowerShell Gallery.
Components
Modules can be made up of the following:
- Functions (
.ps1): Reusable cmdlet-like code blocks. - Cmdlets (
.dll): Compiled .NET classes exposed as cmdlets. - Aliases (
.ps1): Short names for functions or cmdlets. - Variables (
.ps1): Pre-defined variables used by the module. - Help files (
.psd1/.xml): XML help (comment-based or external) for cmdlets. - Data files (
.json,.yaml, etc.): Configuration or lookup data. - Resources (embedded in DLL or
.psd1): Embedded strings, images, etc. - Module manifest (
.psd1): Describes the contents and attributes of the module, its pre-requisites and how the components are processed. This data is stored as key-value pairs in a hash table.