The Get-Module command is a Windows PowerShell cmdlet that allows users to list the modules that are installed on their system. This cmdlet can be used to view the modules that are available in the current session, as well as the modules that are available in the system’s global assembly cache. This cmdlet can also be used to view the modules that are installed in the current user’s profile.
The Get-Module cmdlet is a powerful tool for managing the modules that are installed on a system. It can be used to view the modules that are installed in the current session, as well as the modules that are available in the system’s global assembly cache. It can also be used to view the modules that are installed in the current user’s profile.
Syntax of Get-Module
The syntax for the Get-Module cmdlet is as follows:
Get-Module [[-Name]
Parameters of Get-Module
The Get-Module cmdlet has the following parameters:
Parameter | Description |
---|---|
-Name | Specifies the name of the module to be listed. |
-ListAvailable | Lists all the modules that are available in the system’s global assembly cache. |
-Refresh | Refreshes the list of modules that are available in the system’s global assembly cache. |
-FullyQualifiedName | Specifies the fully qualified name of the module to be listed. |
-CommandName | Specifies the name of the command to be listed. |
-ArgumentList | Specifies the arguments to be passed to the command. |
-Credential | Specifies the credentials to be used for the command. |
-Force | Forces the command to run without prompting for confirmation. |
-WhatIf | Shows what would happen if the command were to run. |
-Confirm | Prompts for confirmation before running the command. |
Inputs of Get-Module
The Get-Module cmdlet accepts the following input:
- Name of the module to be listed
- Fully qualified name of the module to be listed
- Name of the command to be listed
- Arguments to be passed to the command
- Credentials to be used for the command
Outputs of Get-Module
The Get-Module cmdlet produces the following output:
- A list of the modules that are installed on the system
- A list of the modules that are available in the system’s global assembly cache
- A list of the modules that are installed in the current user’s profile
Examples of Get-Module
The following examples demonstrate how to use the Get-Module cmdlet:
- To list all the modules that are installed on the system, use the following command:
Get-Module
- To list all the modules that are available in the system’s global assembly cache, use the following command:
Get-Module -ListAvailable
- To list all the modules that are installed in the current user’s profile, use the following command:
Get-Module -FullyQualifiedName
- To list all the modules that are installed in the specified directory, use the following command:
Get-Module -Name
- To list all the commands that are available in the specified module, use the following command:
Get-Module -CommandName
- To list all the commands that are available in the specified module, with the specified arguments, use the following command:
Get-Module -CommandName
-ArgumentList , , …
Tips for Using Get-Module
The following tips can help you get the most out of the Get-Module cmdlet:
- Use the -ListAvailable parameter to list all the modules that are available in the system’s global assembly cache.
- Use the -Refresh parameter to refresh the list of modules that are available in the system’s global assembly cache.
- Use the -FullyQualifiedName parameter to list all the modules that are installed in the current user’s profile.
- Use the -CommandName parameter to list all the commands that are available in the specified module.
- Use the -ArgumentList parameter to list all the commands that are available in the specified module, with the specified arguments.
- Use the -Credential parameter to specify the credentials to be used for the command.
- Use the -Force parameter to force the command to run without prompting for confirmation.
- Use the -WhatIf parameter to show what would happen if the command were to run.
- Use the -Confirm parameter to prompt for confirmation before running the command.
Conclusion
The Get-Module cmdlet is a powerful tool for managing the modules that are installed on a system. It can be used to view the modules that are installed in the current session, as well as the modules that are available in the system’s global assembly cache. It can also be used to view the modules that are installed in the current user’s profile. The Get-Module cmdlet has a number of parameters that can be used to customize the output, and it can be used with the -WhatIf and -Confirm parameters to ensure that the command is run safely and securely.