One of the great features of PowerShell is the ability to extend its capabilities through the use of modules. These modules can be created by Microsoft or by the community, and they allow you to add additional functionality to your scripts and command-line sessions.
If you want to see which modules are currently installed on your system, there are a few different ways you can do this. Here are three methods:
Method 1: Get-Module
The first method is to use the Get-Module
cmdlet. This cmdlet will display a list of all the modules that are currently loaded in your PowerShell session. To use it, simply open up a PowerShell window and type:
Get-Module
This will show you a list of all the modules that are currently loaded, along with their path and the version number. You can also use the -ListAvailable
parameter to show a list of all the modules that are installed on your system, but not necessarily loaded:
Get-Module -ListAvailable
Method 2: Get-InstalledModule
The second method is to use the Get-InstalledModule
cmdlet, which is available in PowerShell version 5.0 and higher. This cmdlet will display a list of all the modules that are installed on your system, regardless of whether they are loaded or not. To use it, type:
Get-InstalledModule
This cmdlet has several useful parameters that you can use to filter the list of modules. For example, you can use the -Name
parameter to show only modules with a specific name:
Get-InstalledModule -Name Azure*
You can also use the -MinimumVersion
parameter to show only modules with a specific minimum version number:
Get-InstalledModule -MinimumVersion 2.0
Method 3: Get-ChildItem
The third method is to use the Get-ChildItem
the cmdlet to list the contents of the $env:PSModulePath
directory. This directory contains all the modules that are installed on your system, so by listing its contents, you can see all the modules that are available to you. To do this, type:
Get-ChildItem $env:PSModulePath
This will show you a list of all the modules that are installed on your system, along with their path and version number. You can also use the -Recurse
parameter to search subdirectories as well:
Get-ChildItem $env:PSModulePath -Recurse
We looked at three different methods for getting a list of installed modules in PowerShell. Whether you want to see which modules are currently loaded, or a list of all the modules that are installed on your system, these methods should help you get the information you need.