PowerShell Genie

Get-Module

Use Get-Module to list modules loaded in the session, or with -ListAvailable those installed and ready to load.

Command 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — PowerShell module reference

Syntax

1PS> Get-Module [[-Name] <string[]>] [-ListAvailable] [-All] [-FullyQualifiedName <ModuleSpecification[]>] [-PSSession <PSSession>] [<CommonParameters>]
See the command anatomy

Inspect this authored example with fictional data in the bounded browser model. The numbered stages show how its objects change.

Get-Module | Select-Object Name, Version
  1. Stage 1Get-ModulePositional values or no named parameters
  2. Stage 2Select-ObjectPositional values or no named parameters

    Try it

    Windows PowerShell

    Browser simulation · fictional data; no changes to your computer.

    Interactive simulation · fictional data

    Examples

    Select Name, Version

    1PS> Get-Module | Select-Object Name, Version
    Show reference output

    Illustrative output · values vary by environment

    Name                             Version
    -------------------------------  -------
    Microsoft.PowerShell.Management  7.0.0.0
    ActiveDirectory                  1.0.1.0
    Pester                           5.6.1  

    Select first 5

    1PS> Get-Module -ListAvailable | Select-Object -First 5 Name, Version
    Show reference output

    Illustrative output · values vary by environment

    Name                             Version
    -------------------------------  -------
    Microsoft.PowerShell.Management  7.0.0.0
    ActiveDirectory                  1.0.1.0
    Pester                           5.6.1  

    Expand ExportedCommands

    1PS> Get-Module Microsoft.PowerShell.Management | Select-Object -ExpandProperty ExportedCommands
    Show reference output

    Illustrative output · values vary by environment

    Key              Value
    ---              -----
    Get-ChildItem     Get-ChildItem
    Get-Process       Get-Process
    Get-Service       Get-Service

    Parameters

    Parameter definitions:

    • -Name
    • -ListAvailable
    • -All
    • -FullyQualifiedName
    • -PSSession

    PowerShell module reference on Microsoft Learn

    Practical use and troubleshooting

    Practical scenario: Use Get-Module when you need to list modules loaded in the session, or with -ListAvailable those installed and ready to load. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.

    Common error and fix: An empty result without -ListAvailable only means no matching module is loaded. Inspect available modules separately and choose the intended version before importing it. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.

    See also: Import-Module. Get-Module inspects loaded modules, or available modules with -ListAvailable; Import-Module loads a module. Finding an installed module does not prove its prerequisites can be loaded. Read the linked command before substituting it; similar names do not imply identical inputs or output.

    Get-Module reference on Microsoft Learn

    Put this command to work

    Import the testing module

    Import Pester, then display the Pester module record.

    Review the lesson

    Recap

    Get-Module Use Get-Module to list modules loaded in the session, or with -ListAvailable those installed and ready to load.

    Next: Import-Module
    Genie guideGet-Module

    Use Get-Module to list modules loaded in the session, or with -ListAvailable those installed and ready to load. The console below is pre-loaded — run it, then change a value and run it again.