Module

suggest change

A module is a collection of related reusable functions (or cmdlets) that can easily be distributed to other PowerShell users and used in multiple scripts or directly in the console. A module is usually saved in it’s own directory and consists of:

Examples of modules:

To make it easy for PowerShell to find and import a module, it is often placed in one of the known PowerShell module-locations defined in $env:PSModulePath.

Demo

List modules that are installed to one of the known module-locations:

Get-Module -ListAvailable

Import a module, ex. Hyper-V module:

Import-Module Hyper-V

List available commands in a module, ex. the Microsoft.PowerShell.Archive-module

> Import-Module Microsoft.PowerShell.Archive
> Get-Command -Module Microsoft.PowerShell.Archive

CommandType Name             Version Source                      
----------- ----             ------- ------                      
Function    Compress-Archive 1.0.1.0 Microsoft.PowerShell.Archive
Function    Expand-Archive   1.0.1.0 Microsoft.PowerShell.Archive

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents