Install-ChocolateyInstallPackage
Install-ChocolateyInstallPackage
Install-ChocolateyInstallPackage
:choco-info: NOTE
Administrative Access Required.
Installs software into “Programs and Features”. Use Install-ChocolateyPackage when software must be downloaded first.
Syntax
Install-ChocolateyInstallPackage `
-PackageName <String> `
[-FileType <String>] `
[-SilentArgs <String[]>] `
[-File <String>] `
[-File64 <String>] `
[-ValidExitCodes <Object>] `
[-UseOnlyPackageSilentArguments] `
[-IgnoredArguments <Object[]>] [<CommonParameters>]
Description
This will run an installer (local file) on your machine.
Notes
This command will assert UAC/Admin privileges on the machine.
If you are embedding files into a package, ensure that you have the rights to redistribute those files if you are sharing this package publicly (like on the community feed). Otherwise, please use Install-ChocolateyPackage to download those resources from their official distribution points.
This is a native installer wrapper function. A “true” package will contain all the run time files and not an installer. That could come pre-zipped and require unzipping in a PowerShell script. Chocolatey works best when the packages contain the software it is managing. Most software in the Windows world comes as installers and Chocolatey understands how to work with that, hence this wrapper function.
Aliases
None
Examples
EXAMPLE 1
$packageName= 'bob'
$toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)"
$fileLocation = Join-Path $toolsDir 'INSTALLER_EMBEDDED_IN_PACKAGE'
$packageArgs = @{
packageName = $packageName
fileType = 'msi'
file = $fileLocation
silentArgs = "/qn /norestart"
validExitCodes= @(0, 3010, 1641)
softwareName = 'Bob*'
}
Install-ChocolateyInstallPackage @packageArgs
EXAMPLE 2
$packageArgs = @{
packageName = 'bob'
fileType = 'exe'
file = '\\SHARE_LOCATION\to\INSTALLER_FILE'
silentArgs = "/S"
validExitCodes= @(0)
softwareName = 'Bob*'
}
Install-ChocolateyInstallPackage @packageArgs
EXAMPLE 3
$packageName= 'bob'
$toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)"
$fileLocation = Join-Path $toolsDir 'someinstaller.msi'
$packageArgs = @{
packageName = $packageName
fileType = 'msi'
file = $fileLocation
silentArgs = "/qn /norestart MSIPROPERTY=`"true`""
validExitCodes= @(0, 3010, 1641)
softwareName = 'Bob*'
}
Install-ChocolateyInstallPackage @packageArgs
EXAMPLE 4
$packageName= 'bob'
$toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)"
$fileLocation = Join-Path $toolsDir 'someinstaller.msi'
$mstFileLocation = Join-Path $toolsDir 'transform.mst'
$packageArgs = @{
packageName = $packageName
fileType = 'msi'
file = $fileLocation
silentArgs = "/qn /norestart TRANSFORMS=`"$mstFileLocation`""
validExitCodes= @(0, 3010, 1641)
softwareName = 'Bob*'
}
Install-ChocolateyInstallPackage @packageArgs
EXAMPLE 5
Install-ChocolateyInstallPackage 'bob' 'exe' '/S' "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\bob.exe"
EXAMPLE 6
Install-ChocolateyInstallPackage -PackageName 'bob' -FileType 'exe' `
-SilentArgs '/S' `
-File "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\bob.exe" `
-ValidExitCodes @(0)
Inputs
None
Outputs
None
Parameters
-PackageName <String>
Property | Value |
---|---|
Aliases | |
Required? | true |
Position? | 1 |
Default Value | |
Accept Pipeline Input? | false |
-FileType [<String>]
Property | Value |
---|---|
Aliases | installerType, installType |
Required? | false |
Position? | 2 |
Default Value | exe |
Accept Pipeline Input? | false |
-SilentArgs [<String[]>]
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | 3 |
Default Value | |
Accept Pipeline Input? | false |
-File [<String>]
Property | Value |
---|---|
Aliases | fileFullPath |
Required? | false |
Position? | 4 |
Default Value | |
Accept Pipeline Input? | false |
-File64 [<String>]
Property | Value |
---|---|
Aliases | fileFullPath64 |
Required? | false |
Position? | named |
Default Value | |
Accept Pipeline Input? | false |
-ValidExitCodes [<Object>]
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | named |
Default Value | @(0) |
Accept Pipeline Input? | false |
-UseOnlyPackageSilentArguments
Property | Value |
---|---|
Aliases | useOnlyPackageSilentArgs |
Required? | false |
Position? | named |
Default Value | False |
Accept Pipeline Input? | false |
-IgnoredArguments [<Object[]>]
Property | Value |
---|---|
Aliases | |
Required? | false |
Position? | named |
Default Value | |
Accept Pipeline Input? | false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters
http://go.microsoft.com/fwlink/p/?LinkID=113216 .
Links
- Install-ChocolateyPackage
- Uninstall-ChocolateyPackage
- Get-UninstallRegistryKey
- Start-ChocolateyProcessAsAdmin
:choco-info: NOTE
This documentation has been automatically generated from
Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force; Get-Help Install-ChocolateyInstallPackage -Full
.
View the source for Install-ChocolateyInstallPackage