The Install-Module command installs or updates modules from the PowerShell Gallery or any other configured repository. By default, Install-Module adds modules to the path for AllUsers, C:Program FilesWindowsPowerShellModules.
Installing a module under the AllUsers scope requires a user account control administrator token (run as administrator).
For example, the posh-git module may be installed using either of the following two commands:
Find-Module posh-git | Install-Module Install-Module posh-git
Modules may be installed under a user-specific path ($homeDocumentsWindowsPowerShellModules) using the Scope parameter:
Find-Module carbon -Scope CurrentUser
If the most recent version of a module is already installed, the command ends without providing feedback. If a newer version is available that will be automatically installed alongside the original (in a folder named after the version if using PowerShell 5.0).
Reinstallation of an existing version can be forced with the following command:
Install-Module posh-git -Force
The Install-Module command does not provide an option to install modules under the $PSHOME (%SystemRoot%System32WindowsPowerShellv1.0) directory. The $PSHOME path is reserved for modules created by Microsoft that are deployed with the Windows Management Framework (WMF) or the Windows operating system.