Download one or more modules from a repository, and install them on the local computer.
Syntax Install-Module [-InputObject] PSObject[] [-AllowClobber] [-Credential PSCredential] [-Force] [-Proxy Uri] [-ProxyCredential PSCredential] [-Scope {CurrentUser | AllUsers}] [-SkipPublisherCheck] [-AcceptLicense] [-Confirm] [-WhatIf] [CommonParameters] Install-Module [-Name] String[] [-AllowClobber] [-Credential PSCredential] [-Force] [-MaximumVersion Version] [-MinimumVersion Version] [-RequiredVersion Version] [-Repository String[]] [-Proxy Uri] [-ProxyCredential PSCredential] [-Scope {CurrentUser | AllUsers}] [-SkipPublisherCheck] [-AllowPrerelease] [-AcceptLicense] [-Confirm] [-WhatIf] [CommonParameters] Key -AcceptLicense For modules that require a license, AcceptLicense automatically accepts the license agreement during installation. This requires a license.txt in the root directory of the module. -AllowClobber Override warning messages about installation conflicts about existing commands on a computer. Overwrites existing commands that have the same name as commands being installed by a module. AllowClobber and Force can be used together in an Install-Module command. -AllowPrerelease Allows the installation of a module marked as a pre-release. -Confirm Prompt for confirmation before installing. -Credential Specifies a user account that has rights to install a module for a specified package provider or source. -Force Install a module and override warning messages about module installation conflicts. If a module with the same name already exists on the computer, Force allows for multiple versions to be installed. If there is an existing module with the same name and version, Force overwrites that version. Force and AllowClobber can be used together in an Install-Module command. -InputObject Used for pipeline input. -MaximumVersion Specify the maximum version of a single module to install. The version installed must be less than or equal to MaximumVersion. If you want to install multiple modules, you cannot use MaximumVersion. MaximumVersion and RequiredVersion cannot be used in the same Install-Module command. -MinimumVersion Specify the minimum version of a single module to install. The version installed must be greater than or equal to MinimumVersion. If there is a newer version of the module available, the newer version is installed. If you want to install multiple modules, you cannot use MinimumVersion. MinimumVersion and RequiredVersion cannot be used in the same Install-Module command. -Name Specify the exact names of modules to install from the online gallery. A comma-separated list of module names is accepted. The module name must match the module name in the repository. Use Find-Module to get a list of module names. -PassThru Pass any output through the pipeline. -Proxy Specifies a proxy server for the request, rather than connecting directly to the Internet resource. -ProxyCredential Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter. -Repository Specify which repository is used to download and install a module. Used when multiple repositories are registered. Specifies the name of a registered repository in the Install-Module command. To register a repository, use Register-PSRepository. To display registered repositories, use Get-PSRepository. -RequiredVersion Specifies the exact version of a single module to install. If there is no match in the repository for the specified version, an error is displayed. If you want to install multiple modules, you cannot use RequiredVersion. RequiredVersion cannot be used in the same Install-Module command as MinimumVersion or MaximumVersion. -Scope Specify the installation scope of the module. Accepted values: AllUsers, CurrentUser. AllUsers scope: $env:ProgramFiles\PowerShell\Modules CurrentUser scope: $home\Documents\PowerShell\Modules -SkipPublisherCheck Allows you to install a newer version of a module that already exists on your computer. For example, when an existing module is digitally signed by a trusted publisher but the new version is not digitally signed by a trusted publisher. -WhatIf Describe what would happen if you executed the command, without actually executing the command.
Install-Module gets one or more modules that meet specified criteria from an online gallery, verifies that search results are valid modules, and copies module folders to the installation location.
When no scope is defined, or when the value of the Scope parameter is AllUsers, the module is installed to %systemdrive%:\Program Files\WindowsPowerShell\Modules. When the value of Scope is CurrentUser, the module is installed to $home\Documents\WindowsPowerShell\Modules.
You can filter your results based on minimum and exact versions of specified modules.
Install-Module runs on PowerShell 5.0 or later releases
Install a PowerShell module from a local server:
PS C:\> Register-PSRepository -Name 'ss64Repo' -SourceLocation '\\server64\mymodules'
PS C:\> Install-Module 'Demo-Module' -Repository 'ss64Repo'
Find a module in the repository and install the module:
PS C:\> Find-Module -Name PowerShellGet | Install-Module
Install the newest version of the PowerShellGet moduler:
PS C:\> Install-Module -Name PowerShellGet
Install the minimum version of the PowerShellGet module:
PS C:\> Install-Module -Name PowerShellGet -MinimumVersion 2.0.1
Install a specific version of the PowerShellGet module:
PS C:\> Install-Module -Name PowerShellGet -RequiredVersion 2.0.0
Download and install the newest version of a module, only for the current user:
PS C:\> Install-Module -Name PowerShellGet -Scope CurrentUser
"One particular talent stands out among the world-class programmers I’ve known — namely, an ability to move effortlessly between different levels of abstraction" ~ Donald Knuth
Get-InstalledModule - Get installed modules on a computer.
Find-Module - Find a module.
import-module - Add modules to the current session from a local path.
Uninstall-Module - Uninstall a module.
Install-Package - Install one or more software packages.
Uninstall-WindowsFeature - Uninstall/remove roles, role services, and features (2012 R2).
Update-Module - Update a module.
Get-WindowsFeature - Retrieve roles, role services, and features.