Install-Package

Install one or more software packages on the local computer.

Syntax
      Install-Package [-Name] String[]  [-RequiredVersion String] [-MinimumVersion String] [-MaximumVersion String]
         [-AllVersions] [-Source String[]]  [-Credential PSCredential] [-Proxy Uri] [-ProxyCredential PSCredential]
            [-Force]  [-ForceBootstrap]
               [-ProviderName {msi | NuGet | msu |  Programs | PowerShellGet | psl | chocolatey}]
                  [-Confirm] [-WhatIf] [CommonParameters]

      Install-Package [-InputObject] SoftwareIdentity[] [-AllVersions] [-Credential PSCredential] 
         [-Force] [-ForceBootstrap] [-Proxy Uri] [-ProxyCredential PSCredential]
            [-Confirm] [-WhatIf] [CommonParameters]

      Install-Package [-AllVersions] [-AllowPrereleaseVersions] [-ConfigFile String] [-Contains String] 
         [-Credential PSCredential] [-Destination String] [-ExcludeVersion] [-FilterOnTag String[]]
            [-Headers String[]] [-Force] [-ForceBootstrap] [-Proxy ] [-ProxyCredential PSCredential]
               [-Scope {CurrentUser | AllUsers}] [-SkipDependencies] [-SkipValidate]
                  [-Confirm] [-WhatIf] [CommonParameters]
    
      Install-Package [-AcceptLicense] [-AllVersions] [-AllowClobber] [-Command String[]] [-Credential PSCredential] 
         [-DscResource String[] ] [-Filter String] [-Force] [-ForceBootstrap]
            [-Includes {DscResource | Cmdlet | Function | Workflow | RoleCapability}] [-RoleCapability String[]]
               [-InstallUpdate] [-NoPathUpdate] [-PackageManagementProvider String] 
                  [-Proxy Uri] [-ProxyCredential PSCredential] [-PublishLocation String]
                     [-Scope {CurrentUser | AllUsers}] [-ScriptPublishLocation String]
                        [-ScriptSourceLocation String] [-SkipPublisherCheck] [-Tag String[]]
                           [-Type {Module | Script | All}]
                              [-Confirm] [-WhatIf] [CommonParameters]

   
PowerShell 5.1 only:
      Install-Package [-AdditionalArguments String[]]   [-Credential PSCredential] [-Proxy Uri]
         [-ProxyCredential PSCredential] [-AllVersions] [-Force] [-ForceBootstrap]
            [-Confirm] [-WhatIf] [CommonParameters]

PowerShell 5.1 only:
      Install-Package [-AllVersions] [-Credential ] [-Force] [-ForceBootstrap] 
         [-IncludeSystemComponent] [-IncludeWindowsInstaller] [-Proxy ] [-ProxyCredential ]
            [-Confirm] [-WhatIf] [CommonParameters]

Key
   -AcceptLicense
       Automatically accept the license agreement during installation.

   -AdditionalArguments String[]
       One or more additional arguments for installation.
        
   -AllVersions
       Indicates that this cmdlet installs all available versions of the package.
       By default, Install-Package only installs the newest available version.
        
   -AllowClobber
       Override warning messages about conflicts with existing commands.
       Overwrite any existing commands that have the same name as commands being installed.
        
   -AllowPrereleaseVersions
       Allow the installation of packages marked as prerelease.
        
   -Command String[]
       One or more commands for which Find-Package searches.
        
   -ConfigFile String
       A path that contains a configuration file.
        
   -Confirm
       Prompt for confirmation before running the cmdlet.
        
   -Contains String
       Get objects if the -Contains parameter specifies a value that matches any of the object's property values.
        
   -Credential PSCredential
       A user account that has permission to access the computer and run commands.
       Type a user name, such as User64, Domain01\User64, or enter a PSCredential object, generated by
       the Get-Credential cmdlet. If you enter a user name, you will be prompted for the password.
       When the -Credential parameter isn’t specified, Install-Package will use the current user.
        
   -Destination String
       A path to an input object.
        
   -DscResource String[]
       One or more Desired State Configuration (DSC) resources that are searched by Install-Package.
       Use the Find-DscResource cmdlet to find DSC resources.
        
   -ExcludeVersion
       Switch to exclude the version number in the folder path.
        
   -Filter String
       Terms to search for within the Name and Description properties.
        
   -FilterOnTag String[]
       A tag that filters results and excludes results that don’t contain the specified tag.
        
   -Force
       Force the command to run without asking for user confirmation.
       Override any restrictions that prevent Install-Package from succeeding, with the exception of security.
        
   -ForceBootstrap
       Force PackageManagement to automatically install the package provider for the specified package.
        
   -Headers String[]
       Specifies the package headers.
        
   -IncludeSystemComponent
       Include system components in the results.
        
   -IncludeWindowsInstaller
       Include the Windows installer in the results.
        
   -Includes String[]
       Whether Install-Package should find all package types. 
       Accepted values: Cmdlet, DscResource, Function, RoleCapability, Workflow
        
   -InputObject SoftwareIdentity[]
       Specifies a package by using the package's SoftwareIdentity type.
       Accepts pipeline input.
       Find-Package outputs a SoftwareIdentity object.
   
   -InstallUpdate
       Install updates.
        
   -MaximumVersion String
       The maximum allowed version of the package that you want to find. If you do not specify this 
       parameter, Install-Package installs the package's newest version.
        
   -MinimumVersion String
       The minimum allowed version of the package that you want to find. If you do not add this parameter, Install-Package
       will install the package's newest version that satisfies any version specified by the -MaximumVersion parameter.
        
   -Name String[]
       One or more package names. Multiple names must be separated by commas.
        
   -NoPathUpdate
       NoPathUpdate only applies to the Install-Script cmdlet.
       NoPathUpdate is a dynamic parameter added by the provider and isn’t supported by Install-Package.
        
   -PackageManagementProvider String
       The name of the Package Management provider.
        
   -ProviderName String[]
       One or more package provider names to which to scope your package search. You can get package 
       provider names by running Get-PackageProvider.
        
   -Proxy Uri
       A proxy server for the request, rather than connecting directly to an internet resource.

   -ProxyCredential PSCredential
       A user account that has permission to use the proxy server specified by the -Proxy parameter.

   -PublishLocation String
       A location for publishing the package.

   -RequiredVersion String
       Specifies the exact allowed version of the package that you want to install. If you do not add this parameter, 
       Install-Package installs the newest available version of the package that also satisfies any maximum version 
       specified by the MaximumVersion parameter.

   -RoleCapability String[]
       An array of role capabilities.

   -Scope String
       Specifies the scope to which to install the package.
       Accepted values: CurrentUser, AllUsers

   -ScriptPublishLocation String
       The path to a script's published location.

   -ScriptSourceLocation String
       The script source location.

   -SkipDependencies
       Skip the installation of software dependencies.

   -SkipPublisherCheck
       Allow a package version that is newer than your installed version.
       For example, an installed package that is digitally signed by a trusted publisher but a new version isn’t digitally signed.

   -SkipValidate
       Skip validating the credentials of a package.

   -Source String[]
       Specifies one or more package sources. Multiple package source names must be separated by commas. You can get 
       package source names by running the Get-PackageSource cmdlet.

   -Tag String[]
       One or more strings to search for in the package metadata.
        
   -Type String
       Whether to search for packages with a module, a script, or both. 
       Accepted values: Module, Script, All

   -WhatIf
      Describe what would happen if you executed the command, without actually executing the command.

Install-Package installs one or more software packages on the local computer.
If you have multiple software sources, use Get-PackageProvider and Get-PackageSource to display details about your providers.

Examples

Install a software package and its dependencies:

PS C:\> Install-Package -Name NuGet.Core -Source MyNuGet -Credential ss64dom\User64

Use Find-Package to install a package:

PS C:\> Find-Package -Name NuGet.Core -Source MyNuGet | Install-Package

Install from a local .MSI:

PS C:\> install-package .\demofile.msi

note this does not allow passing parameters to the MSI,
to do that use Start-Process msiexec.exe -ArgumentList 'arg1' 123 ...

Install packages by specifying a range of versions:

PS C:\> Install-Package -Name NuGet.Core -Source MyNuGet -MinimumVersion 2.8.0 -MaximumVersion 2.9.0

"If slaughterhouses had glass walls, everyone would be a vegetarian" ~ Paul McCartney

Related PowerShell Cmdlets

Get-InstalledModule - Get installed modules on a computer.
Get-PackageProvider
Get-PackageSource
Find-Module - Find a module (PowerShellGet).
import-module - Add modules to the current session from a local path.
Uninstall-Module - Uninstall a module.
Uninstall-WindowsFeature - Uninstall/remove roles, role services, and features (2012 R2).
Update-Module - Update a module.
Install-Script - Install a script (PowerShellGet).
Get-WindowsFeature - Retrieve roles, role services, and features.


 
Copyright © 1999-2024 SS64.com
Some rights reserved