With the Get-InstalledModule
cmdlet, we can effortlessly list installed modules, check their versions, and gather additional details like their repository and description.
In this article, we will discuss step-by-step instructions and examples to use the Get-InstalledModule cmdlet effectively.
Why Use Get-InstalledModule?
The Get-InstalledModule
cmdlet is a PowerShellGet tool that allows users to:
- List all installed PowerShell modules.
- Retrieve specific module versions.
- Identify module repositories and descriptions.
By using this cmdlet, we can streamline module management.
Understanding Get-InstalledModule
Get-InstalledModule cmdlet retrieves a list of PowerShell modules installed using PowerShellGet. It provides valuable details such as:
- Module name
- Version
- Repository source
- Description
Here’s the syntax for the cmdlet:
Get-InstalledModule
[[-Name] <String[]>]
[-MinimumVersion <String>]
[-RequiredVersion <String>]
[-MaximumVersion <String>]
[-AllVersions]
[-AllowPrerelease]
[<CommonParameters>]
Parameters
- Name – Specifies the names of the modules (as an array).
- MinimumVersion – Specifies the minimum version of a module to get.
- RequiredVersion – Fetches an exact module version.
- MaximumVersion – Filters modules to those with a version less than or equal to this value.
- AllVersions – Retrieves all available versions of a module.
Let’s understand how to use the Get-InstalledModule cmdlet with practical examples.
How to List All Installed Modules
To list all installed PowerShell modules, run the following command:
Get-InstalledModule
In the above PowerShell script, the Get-InstalledModule command fetches a list of all modules installed on your system along with their version, name, repository, and description.
PS C:\> Get-InstalledModule
Version Name Repository Description
------- ---- ---------- -----------
1.3 FileSplitter PSGallery provides PowerShell commands to split a file in ...
PS C:\>
How to Get Specific Versions of a Module
To fetch specific versions of a module, use the Name
, MinimumVersion
, and MaximumVersion
parameters.
Get-InstalledModule -Name "FileSplitter" -MinimumVersion 1.0 -MaximumVersion 1.5
In the above PowerShell script, the Name parameter specifies the module name (e.g., “FileSplitter”), MinimumVersion sets the lower boundary of the version range (e.g., 1.0), and MaximumVersion sets the upper boundary of the version range (e.g., 1.5).
This command ensures that only modules with versions between 1.0
and 1.5
are retrieved.
PS C:\> Get-InstalledModule -Name "FileSplitter" -MinimumVersion 1.0 -MaximumVersion 1.5
Version Name Repository Description
------- ---- ---------- -----------
1.3 FileSplitter PSGallery provides PowerShell commands to split a file in ...
PS C:\>
In this example, the FileSplitter
module is found with the version 1.3
, which meets the criteria of being between 1.0
and 1.5
.
Cool Tip: How to get module path in PowerShell!
Conclusion
The Get-InstalledModule cmdlet is a powerful cmdlet for listing installed PowerShell modules and retrieving detailed information about them.
Use the MinimumVersion
and MaximumVersion
parameters to target specific module versions.
You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.