Windows PowerShell v3 Modules

Introduction to PowerShell v3 Modules

Knowledge of modules is particularly important in PowerShell v3, because the cmdlets they contain extend the range of tasks we can achieve through scripting.  Incidentally, modules also explains how people arrive at different tallies for cmdlets in PowerShell v3; the precise number depends on how many modules you import.

PowerShell Module Topics

I think of PowerShell modules as a collection of cmdlets that specialize in a particular computing area such as networking, Active Directory, or new in version 3, DHCP.



As with so many PowerShell commands, the best place to start is with the ‘Get’ verb, thus:

# Windows PowerShell Module List

Note 1: Even though this command returns multiple items, as usual, the PowerShell noun is singular: -Module.

Note 2: Beginners need not be concerned that there are different types of modules, for example, script and manifest; the point is that modules deliver more cmdlets.

Get-Module -ListAvailable

# PowerShell Modules Available to Import
Get-Module -ListAvailable

What next?  We have ‘gotten’ the modules, but how do we install or import them?  The answer to that question is to search for other Module cmdlets.

# List of Windows PowerShell Module Cmdlets
Get-Command -Noun module

CommandType  Name
————        —-
 Cmdlet  Get-Module
 Cmdlet  Import-Module
 Cmdlet  New-Module
 Cmdlet  Remove-Module

Result: Import-Module is useful for everyone, and New-Module is vital for developers. However, I can’t yet think of why we need to Remove-Module!

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v11.5 v11.5

SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

What I like best is the way NPM suggests solutions to network problems.  Its also has the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.

Download a free trial of Solarwinds’ Network Performance Monitor


Here is a classic Use of PowerShell’s Pipeline (|).  Once we have a list of possible PowerShell modules, then we can pipe the output into an Import-Module command.  The classic combination is to start with ‘Get-Noun’ then pipe into ‘Set-Noun’, but in this case we will pipe the output into ‘Import-Module’.

# PowerShell Import-Module Example
Get-Module -ListAvailable -Name PS* | Import-Module

Note 3: Just as you can abbreviate -ComputerName to -Computer, so you can abbreviate -ListAvailable to -List.  All that PowerShell requires of your parameter abbreviation is that it’s unique.  That said, I don’t like to push shorting parameter names to far, I prefer my scripts to make sense when I read them months later.

Note 4: I introduced -Name to filter all the modules beginning with ‘PS’.

Note 5: You may wish to run Get-Module once more to the extra modules that you just imported.

A Rare Use of Remove-Module

In testing, or to experiment with Import-Module, you may wish to introduce Remove-Module

Get-Module -ListAvailable -Name PS* | Remove-Module

Note 6: PowerShell is consistent in its use of the Remove verb.  In fact there is no delete, kill, or cancel verb in PowerShell, it’s always ‘Remove’.  To see what I mean check with Get-Command -verb Remove.  (And then try -verb Delete).

See more examples of PowerShell’s Import-Module »

Summary of Modules in PowerShell v3

PowerShell v2 shipped with built-in modules, and also allowed us to create our own modules.  In PowerShell v3 the emphasis has shifted from building ones own modules to importing Microsoft, and researching 3rd party modules.

If you like this page then please share it with your friends


See more Microsoft PowerShell tutorials

PowerShell Tutorials  • Methods  • Cmdlets  • PS Snapin  • Profile.ps1  • Exchange 2007

Command & Expression Mode  • PowerShell pipeline (|)  • PowerShell ‘where‘  • PowerShell ‘Sort’

Windows PowerShell Modules  • Import-Module  • PowerShell Module Directory 

If you see an error of any kind, do let me know.  Please report any factual mistakes, grammatical errors or broken links.