Home » PowerShell Tips » PowerShell List Installed Modules

PowerShell List Installed Modules

Use the Get-Module cmdlet in PowerShell to list installed modules. PSModulePath variable contains the location path of Windows PowerShell modules.

A PowerShell module is a package that contains members such as cmdlets, functions, variables, providers, and aliases. PowerShell has predefined core modules. You can get a list of PowerShell modules, installed if it is not available in the PowerShell list modules.

PSModulePath environment variable contains system and user directories PowerShell modules location path as below

PS C:\> $env:PSModulePath -split ';'                                                                                    C:\Users\admin\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\
c:\Program Files (x86)\Microsoft SQL Server\140\Tools\PowerShell\Modules\
C:\Program Files (x86)\Microsoft SQL Server\150\Tools\PowerShell\Modules\
C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell
PS C:\>   

In this article, we will discuss how to get installed modules loaded in the current session, modules directory, and list installed PowerShell modules.

Get-Module gets a list of PowerShell modules imported in the current session.

Get-Module -ListAvailable parameter get PowerShell modules list imported from $env: PSModulePath an environment variable.

Get-Module Syntax

Get-Module cmdlet gets a list of PowerShell modules imported in the current session or imported from the PSModulePath environment path.

Syntax:

Get-Module
   [[-Name] <String[]>]
   [-FullyQualifiedName <ModuleSpecification[]>]
   [-All]
   [-ListAvailable]
   [-PSEdition <String>]
   [-SkipEditionCheck]
   [-Refresh]
   [<CommonParameters>]

Parameters:

-Name: Specify the name of the PowerShell module to get from the available PowerShell list modules. You can use wildcard characters to get the module.

-FullyQualifiedName: Specify module name in the format of ModuleSpecification object.

-ListAvailable:- list all installed PowerShell modules.

-PSEdition: Gets module that supports specified edition of PowerShell, either Desktop or Core

PowerShell List Modules imported into Session

Use the Get-Module cmdlet in PowerShell to list installed PowerShell modules imported in the current session, and run the following command in the PowerShell console.

Get-Module

The above command in PowerShell shows installed modules as given below

Get-Module - List of PowerShell modules in current session
Get-Module – List of PowerShell modules in the current session

Cool Tip: How to fix Unable to resolve package source in PowerShell!

Get PowerShell Module Path

You can find the PowerShell module path using the Get-Module ListAvailable parameter and wildcard character after the module name.

(Get-Module -ListAvailable SQL*).path 

This script gets the PowerShell module path for the module name starting with SQL.

The output of the above script to find the PowerShell module directory is:

PowerShell get module path
PowerShell Module Path

Get-Module List of PowerShell Modules

PowerShell Get-Module cmdlet has a ListAvailable parameter to get installed modules imported from the $env: PSModulePath environment variable.

Get-Module -ListAvailable

The above command PowerShell modules list imported from an environment variable $env:PSModulePath.

It returns a list of PowerShell installed modules from different PowerShell module paths such as documents, system32 folder path, and program files path.

Conclusion

I hope the above article on how to get a list of PowerShell modules is helpful to you.

Get-Module gets a list of PowerShell module in the current session.

Using the ListAvailable parameter, it returns a list of installed PowerShell modules imported from the $env: PSModulePath environment variable.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.