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>

PropertyValue
Aliases
Required?true
Position?1
Default Value
Accept Pipeline Input?false

-FileType [<String>]

PropertyValue
AliasesinstallerType, installType
Required?false
Position?2
Default Valueexe
Accept Pipeline Input?false

-SilentArgs [<String[]>]

PropertyValue
Aliases
Required?false
Position?3
Default Value
Accept Pipeline Input?false

-File [<String>]

PropertyValue
AliasesfileFullPath
Required?false
Position?4
Default Value
Accept Pipeline Input?false

-File64 [<String>]

PropertyValue
AliasesfileFullPath64
Required?false
Position?named
Default Value
Accept Pipeline Input?false

-ValidExitCodes [<Object>]

PropertyValue
Aliases
Required?false
Position?named
Default Value@(0)
Accept Pipeline Input?false

-UseOnlyPackageSilentArguments

PropertyValue
AliasesuseOnlyPackageSilentArgs
Required?false
Position?named
Default ValueFalse
Accept Pipeline Input?false

-IgnoredArguments [<Object[]>]

PropertyValue
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 .

Function Reference

: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