Windows PowerShell is a powerful command-line interface that can be used to automate tasks and manage Windows systems. The Install-Module command is one of the most important commands in Windows PowerShell, as it allows users to install modules from the PowerShell Gallery. In this article, we will explore the syntax, parameters, inputs, outputs, examples, and tips for using the Install-Module command.
Syntax
The syntax for the Install-Module command is as follows:
Install-Module [-Name]
Parameters
The parameters for the Install-Module command are as follows:
Parameter | Description |
---|---|
-Name | Specifies the name of the module to install. |
-RequiredVersion | Specifies the required version of the module to install. |
-MinimumVersion | Specifies the minimum version of the module to install. |
-MaximumVersion | Specifies the maximum version of the module to install. |
-Repository | Specifies the repository from which to install the module. |
-Scope | Specifies the scope in which to install the module. |
-Force | Forces the installation of the module. |
-AllowClobber | Allows the module to overwrite existing files. |
-WhatIf | Shows what would happen if the command were to run. |
-Confirm | Prompts the user for confirmation before running the command. |
-Credential | Specifies the credentials to use when connecting to the repository. |
-Proxy | Specifies the proxy server to use when connecting to the repository. |
-ProxyCredential | Specifies the credentials to use when connecting to the proxy server. |
-SkipPublisherCheck | Skips the publisher check when installing the module. |
-DisableNameChecking | Disables the name checking when installing the module. |
-AllowPrerelease | Allows the installation of prerelease versions of the module. |
-Refresh | Refreshes the list of available modules. |
-WarningAction | Specifies the action to take when a warning is generated. |
-WarningVariable | Specifies the variable in which to store the warning message. |
-Verbose | Enables verbose output. |
-Debug | Enables debug output. |
-ErrorAction | Specifies the action to take when an error is generated. |
-ErrorVariable | Specifies the variable in which to store the error message. |
-OutVariable | Specifies the variable in which to store the output. |
-OutBuffer | Specifies the size of the output buffer. |
-Passthru | Returns the object created by the command. |
-Source | Specifies the source from which to install the module. |
-Tag | Specifies the tags to use when searching for the module. |
-Culture | Specifies the culture to use when searching for the module. |
-EnableException | Enables the throwing of exceptions. |
-UseWindowsPowerShell | Uses Windows PowerShell instead of PowerShell Core. |
Inputs
The Install-Module command requires the following inputs:
- Name – The name of the module to install.
- RequiredVersion – The required version of the module to install.
- MinimumVersion – The minimum version of the module to install.
- MaximumVersion – The maximum version of the module to install.
- Repository – The repository from which to install the module.
- Scope – The scope in which to install the module.
- Credential – The credentials to use when connecting to the repository.
- Proxy – The proxy server to use when connecting to the repository.
- ProxyCredential – The credentials to use when connecting to the proxy server.
- Source – The source from which to install the module.
- Tag – The tags to use when searching for the module.
<