Get List of PowerShell Modules

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

You can get PowerShell installed modules using Get-Module cmdlet in PowerShell. PSModulePath variable contains the location path of Windows PowerShell 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, I will explain how to get list of PowerShell modules loaded in current session and list of installed modules.

Get-Module get list of PowerShell modules imported in current session.

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

Get-Module Syntax

Display list of modules imported in current session or imported from PSModulePath environment path.

Syntax:

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

Parameters:

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

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

-ListAvailable – list all installed PowerShell modules.

-PSEdition – Gets module that support specified edition of PowerShell, either Desktop or Core

Get List of PowerShell Modules imported in Session

You can use Get-Module cmdlet in PowerShell to get list of PowerShell modules imported in current session, run below command in PowerShell console as below

Get-Module

Above command gets list of PowerShell modules as below

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

Get-Module List of PowerShell Modules

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

Get-Module -ListAvailable

Above command get list of PowerShell modules imported from environment variable $env:PSModulePath.

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

Conclusion

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

Get-Module get list of PowerShell module in current session and using ListAvailable parameter, it returns list of PowerShell installed modules imported from $env:PSModulePath environment variable.

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

Leave a Comment