Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Downloads:

330,128,026

Downloads of v 0.9.9.12:

387,177

Last Update:

18 Mar 2016

Package Maintainer(s):

Software Author(s):

  • Rob Reynolds
  • The Chocolatey Team

Tags:

nuget apt-get machine repository chocolatey

Chocolatey

This is not the latest version of Chocolatey available.

  • 1
  • 2
  • 3

0.9.9.12 | Updated: 18 Mar 2016

Downloads:

330,128,026

Downloads of v 0.9.9.12:

387,177

Software Author(s):

  • Rob Reynolds
  • The Chocolatey Team

Chocolatey 0.9.9.12

This is not the latest version of Chocolatey available.

  • 1
  • 2
  • 3

Some Checks Have Failed or Are Not Yet Complete

Not All Tests Have Passed


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Resulted in Investigate

Details
NOTE

Please visit our documentation to learn how to install/uninstall Chocolatey.

To upgrade Chocolatey, run the following command from the command line or from PowerShell:

>
Package Approved

This package was approved as a trusted package on 01 Jun 2016.

Description

Chocolatey is a package manager for Windows (like apt-get but for Windows). It was designed to be a decentralized framework for quickly installing applications and tools that you need. It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err computer.

Chocolatey is brought to you by the work and inspiration of the community, the work and thankless nights of the Chocolatey Team, with Rob heading up the direction.

You can host your own sources and add them to Chocolatey, you can extend Chocolatey's capabilities, and folks, it's only going to get better.

Commands

There are quite a few commands you can call - you should check out the command reference. Here are the most common:

  • Search - choco search something
  • List - choco list -lo
  • Install - choco install baretail
  • Pin - choco pin windirstat
  • Upgrade - choco upgrade baretail
  • Uninstall - choco uninstall baretail

Alternative installation sources (TEMPORARILY DISABLED IN 0.9.9 series):

  • Install ruby gem - choco install compass -source ruby
  • Install python egg - choco install sphynx -source python
  • Install windows feature - choco install IIS -source windowsfeatures
  • Install webpi feature - choco install IIS7.5Express -source webpi

For more advanced commands and switches, use choco -? or choco command -h. You can also look at the command reference, including how you can force a package to install the x86 version of a package.

Create Packages?

We have some great guidance on how to do that. Where? I'll give you a hint, it rhymes with sticky! Wiki!

In that mess there is a link to the Helper Reference.


tools\chocolateyInstall.ps1
$toolsPath = (Split-Path -parent $MyInvocation.MyCommand.Definition)

# ensure module loading preference is on
$PSModuleAutoLoadingPreference = "All";

$modules = Get-ChildItem $toolsPath -Filter *.psm1
$modules | ForEach-Object {
														$psm1File = $_.FullName;
														$moduleName = $([System.IO.Path]::GetFileNameWithoutExtension($psm1File))
														if (Get-Module $moduleName) {
                              remove-module $moduleName -ErrorAction SilentlyContinue;
                            }
														import-module -name  $psm1File;
													}

Initialize-Chocolatey
tools\chocolateyInstall\choco.exe
md5: F85743381AFA9067D13C33B9A0277ED7 | sha1: 797616DDC83BCD108B7DB1A3CA2FFFD2D289DDAF | sha256: 0CEE4AB0FD764CF41D56CE4BDED7F0E96C71D8782DFD9FB6623E003FAEBDE21D | sha512: BFC1449C9F9BC1813BCBC91582296FB8D811657A647AE264D86D6686BFC3029B447D920417E5D40A0B4C2E2C9D0C36EA3A9E46E488E3D486C8D21F52158B9294
tools\chocolateyInstall\choco.exe.ignore
 
tools\chocolateyInstall\helpers\chocolateyInstaller.psm1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

$helpersPath = (Split-Path -parent $MyInvocation.MyCommand.Definition);

$DebugPreference = "SilentlyContinue"
if ($env:ChocolateyEnvironmentDebug -eq 'true') { $DebugPreference = "Continue"; }
$VerbosePreference = "SilentlyContinue"
if ($env:ChocolateyEnvironmentVerbose -eq 'true') { $VerbosePreference = "Continue"; $verbosity = $true }

$installArguments = $env:chocolateyInstallArguments

$overrideArgs = $false
if ($env:chocolateyInstallOverride -eq 'true') { $overrideArgs = $true }

$forceX86 = $false
if ($env:chocolateyForceX86 -eq 'true') { $forceX86 = $true }

$packageParameters = $env:chocolateyPackageParameters

# ensure module loading preference is on
$PSModuleAutoLoadingPreference = "All";

Write-Debug "Posh version is $($psversiontable.PsVersion.ToString())"

# grab functions from files
Get-Item $helpersPath\functions\*.ps1 |
  ? { -not ($_.Name.Contains(".Tests.")) } |
    % {
	  . $_.FullName;
	  #Export-ModuleMember -Function $_.BaseName
    }

# load extensions if they exist
$extensionsPath = Join-Path "$helpersPath" '..\extensions'
if(Test-Path($extensionsPath)) {
  Write-Debug 'Loading community extensions'
  #Resolve-Path $extensionsPath\**\*\*.psm1 | % { Write-Debug "Importing `'$_`'"; Import-Module $_.ProviderPath }
  Get-ChildItem $extensionsPath -recurse -filter "*.psm1" | Select -ExpandProperty FullName | % { Write-Debug "Importing `'$_`'"; Import-Module $_; }
  Get-ChildItem $extensionsPath -recurse -filter "*.dll" | Select -ExpandProperty FullName | % { Write-Debug "Importing `'$_`'"; Import-Module $_; }
}

Export-ModuleMember -Function * -Alias * -Cmdlet *
tools\chocolateyInstall\helpers\chocolateyScriptRunner.ps1
param(
  [alias("ia","installArgs")][string] $installArguments = '',
  [alias("o","override","overrideArguments","notSilent")]
  [switch] $overrideArgs = $false,
  [alias("x86")][switch] $forceX86 = $false,
  [alias("params","parameters","pkgParams")][string]$packageParameters = '',
  [string]$packageScript
)

Write-Debug "Running 'ChocolateyScriptRunner' for $($env:packageName) v$($env:packageVersion) with packageScript `'$packageScript`', packageFolder:`'$($env:packageFolder)`', installArguments: `'$installArguments`', packageParameters: `'$packageParameters`',"

## Set the culture to invariant
$currentThread = [System.Threading.Thread]::CurrentThread;
$culture = [System.Globalization.CultureInfo]::InvariantCulture;
$currentThread.CurrentCulture = $culture;
$currentThread.CurrentUICulture = $culture;

$RunNote = "DarkCyan"
$Warning = "Magenta"
$ErrorColor = "Red"
$Note = "Green"

$version = $env:packageVersion
$packageName = $env:packageName
$packageVersion = $env:packageVersion
$packageFolder = $env:packageFolder

$helpersPath = (Split-Path -parent $MyInvocation.MyCommand.Definition);
$nugetChocolateyPath = (Split-Path -parent $helpersPath)
$nugetPath = $nugetChocolateyPath
$nugetExePath = Join-Path $nuGetPath 'bin'
$nugetLibPath = Join-Path $nuGetPath 'lib'
$badLibPath = Join-Path $nuGetPath 'lib-bad'
$extensionsPath = Join-Path $nugetPath 'extensions'
$chocInstallVariableName = "ChocolateyInstall"
$chocoTools = Join-Path $nuGetPath 'tools'
$nugetExe = Join-Path $chocoTools 'nuget.exe'
$7zip = Join-Path $chocoTools '7za.exe'
$ShimGen = Join-Path $chocoTools 'shimgen.exe'
$checksumExe = Join-Path $chocoTools 'checksum.exe'

Write-Debug "Running `'$packageScript`'";
& "$packageScript"
tools\chocolateyInstall\helpers\functions\Get-BinRoot.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Get-BinRoot {

  Write-Debug "Running 'Get-BinRoot'";
  Write-Host "Get-BinRoot is going to be deprecated by v1. Many packages no longer require it since the folders no longer have versions on them."

  # Since CamelCase was decided upon when $env:ChocolateyInstall was first invented, whe should stick to this convention and use $env:ChocolateyBinRoot.
  # I propose:
  #    1) all occurances of $env:chocolatey_bin_root be replaced with $env:ChocolateyBinRoot;
  #    2) Make the new Chocolatey Installer for new users explicitly set (if not exists) $env:ChocolateyInstall and $env:ChocolateyBinRoot as environment variables so users will smile and understand;
  #    3) Make new Chocolatey convert old $env:chocolatey_bin_root to $env:ChocolateyBinRoot
  #    4) If there is no bin root, we default to SystemDrive\tools

  $binRoot = ''

  # Clean up wrongfully set C:\
  if ($env:ChocolateyBinRoot -eq $env:systemdrive) {
    # Read but untested: Setting a variable = an empty string will remove it completely.
    $env:ChocolateyBinRoot = ''
  }

  # For now, check old var first
  if ($env:ChocolateyBinRoot -eq $null) { # If no value
    if ($env:chocolatey_bin_root -eq $null) { # Try old var
      $env:ChocolateyBinRoot = join-path $env:systemdrive 'tools'
    }
    else {
      $env:ChocolateyBinRoot = $env:chocolatey_bin_root
    }
  }

  # My ChocolateyBinRoot is C:\Common\bin, but looking at other packages, not everyone assumes ChocolateyBinRoot is prepended with a drive letter.
  if (-not($env:ChocolateyBinRoot -imatch "^\w:")) {
    # Add drive letter
    $binRoot = join-path $env:systemdrive $env:ChocolateyBinRoot
  }
  else {
    $binRoot = $env:ChocolateyBinRoot
  }

  # Now that we figured out the binRoot, let's store it as per proposal #3 line #7
  if (-not($env:ChocolateyBinRoot -eq $binRoot)) {
    Set-EnvironmentVariable -Name "ChocolateyBinRoot" -Value $binRoot -Scope User
    # Note that user variables pose a problem when there are two admins on one computer. But this is what was decided upon.
  }

  return $binRoot
}
tools\chocolateyInstall\helpers\functions\Get-CheckSumValid.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


function Get-ChecksumValid {
param(
  [string] $file,
  [string] $checksum = '',
  [string] $checksumType = 'md5'
)
  Write-Debug "Running 'Get-ChecksumValid' with file:`'$file`', checksum: `'$checksum`', checksumType: `'$checksumType`'";
  if ($env:chocolateyIgnoreChecksums -eq 'true') {
    Write-Warning "Ignoring checksums due to feature checksumFiles = false or config ignoreChecksums = true."
    return
  }
  if ($checksum -eq '' -or $checksum -eq $null) { return }

  if (!([System.IO.File]::Exists($file))) { throw "Unable to checksum a file that doesn't exist - Could not find file `'$file`'" }

  if ($checksumType -ne 'sha1' -and $checksumType -ne 'sha256' -and $checksumType -ne 'sha512' -and $checksumType -ne 'md5') {
    Write-Debug 'Setting checksumType to md5 due to non-set value or type is not specified correctly.'
    $checksumType = 'md5'
  }

  $checksumExe = Join-Path "$helpersPath" '..\tools\checksum.exe'
  if (!([System.IO.File]::Exists($checksumExe))) {
    Update-SessionEnvironment
    $checksumExe = Join-Path "$env:ChocolateyInstall" 'tools\checksum.exe'
  }
  Write-Debug "checksum.exe found at `'$checksumExe`'"

  $params = "-c=`"$checksum`" -t=`"$checksumType`" -f=`"$file`""

  Write-Debug "Executing command ['$checksumExe' $params]"
  $process = New-Object System.Diagnostics.Process
  $process.StartInfo = New-Object System.Diagnostics.ProcessStartInfo($checksumExe, $params)
  $process.StartInfo.UseShellExecute = $false
  $process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden

  $process.Start() | Out-Null
  $process.WaitForExit()
  $exitCode = $process.ExitCode
  $process.Dispose()

  Write-Debug "Command [`'$checksumExe`' $params] exited with `'$exitCode`'."

  if ($exitCode -ne 0) {
    throw "Checksum for `'$file'` did not meet `'$checksum`' for checksum type `'$checksumType`'."
  }

  #$fileCheckSumActual = $md5Output.Split(' ')[0]
  # if ($fileCheckSumActual -ne $checkSum) {
  #   throw "CheckSum for `'$file'` did not meet `'$checkSum`'."
  # }
}
tools\chocolateyInstall\helpers\functions\Get-ChocolateyUnzip.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Get-ChocolateyUnzip {
<#
.SYNOPSIS
Unzips an archive file and returns the location for further processing.

.DESCRIPTION
This unzips files using the 7-zip standalone command line tool 7za.exe.
Supported archive formats are: 7z, lzma, cab, zip, gzip, bzip2, Z and tar.

.PARAMETER FileFullPath
This is the full path to your zip file.

.PARAMETER Destination
This is a directory where you would like the unzipped files to end up.
If it does not exist, it will be created.

.PARAMETER SpecificFolder
OPTIONAL - This is a specific directory within zip file to extract.

.PARAMETER PackageName
OPTIONAL - This will faciliate logging unzip activity for subsequent uninstall

.EXAMPLE
$scriptPath = (Split-Path -parent $MyInvocation.MyCommand.Definition)
Get-ChocolateyUnzip "c:\someFile.zip" $scriptPath somedirinzip\somedirinzip

.OUTPUTS
Returns the passed in $destination.

.NOTES
This helper reduces the number of lines one would have to write to unzip a file to 1 line.
If extraction fails, an exception is thrown.

#>
param(
  [string] $fileFullPath,
  [string] $destination,
  [string] $specificFolder,
  [string] $packageName
)
  $zipfileFullPath=$fileFullPath
  if ($specificfolder) {
    $fileFullPath=join-path $fileFullPath $specificFolder
  }

  Write-Debug "Running 'Get-ChocolateyUnzip' with fileFullPath:`'$fileFullPath`'', destination: `'$destination`', specificFolder: `'$specificFolder``, packageName: `'$packageName`'";

  if ($packageName) {
    $packagelibPath = $env:ChocolateyPackageFolder
    if (!(Test-Path -path $packagelibPath)) {
      New-Item $packagelibPath -type directory
    }

    $zipFilename=split-path $zipfileFullPath -Leaf
    $zipExtractLogFullPath= Join-Path $packagelibPath $zipFilename`.txt
  }

  Write-Host "Extracting $fileFullPath to $destination..."
  if (![System.IO.Directory]::Exists($destination)) {[System.IO.Directory]::CreateDirectory($destination)}

  $7zip = Join-Path "$helpersPath" '..\tools\7za.exe'
  if (!([System.IO.File]::Exists($7zip))) {
	Update-SessionEnvironment
	$7zip = Join-Path "$env:ChocolateyInstall" 'tools\7za.exe'
  }
  $7zip = [System.IO.Path]::GetFullPath($7zip)
  Write-Debug "7zip found at `'$7zip`'"

  # 32-bit 7za.exe would not find C:\Windows\System32\config\systemprofile\AppData\Local\Temp,
  # because it gets translated to C:\Windows\SysWOW64\... by the WOW redirection layer.
  # Replace System32 with sysnative, which does not get redirected.
  if ([IntPtr]::Size -ne 4) {
    $fileFullPath32 = $fileFullPath -ireplace ([regex]::Escape([Environment]::GetFolderPath('System'))),(Join-Path $Env:SystemRoot sysnative)
    $destination32 = $destination -ireplace ([regex]::Escape([Environment]::GetFolderPath('System'))),(Join-Path $Env:SystemRoot sysnative)
  } else {
    $fileFullPath32 = $fileFullPath
    $destination32 = $destination
  }

  $exitCode = -1
  $unzipOps = {
    param($7zip, $destination, $fileFullPath, [ref]$exitCodeRef)
    $params = "x -aoa -o`"$destination`" -y `"$fileFullPath`""
    Write-Debug "Executing command ['$7zip' $params]"
    $process = New-Object System.Diagnostics.Process
    $process.StartInfo = new-object System.Diagnostics.ProcessStartInfo($7zip, $params)
    $process.StartInfo.UseShellExecute = $false
    $process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden

    $process.Start() | Out-Null
    $process.WaitForExit()
    $processExitCode = $process.ExitCode
    $process.Dispose()
    Write-Debug "Command ['$7zip' $params] exited with `'$processExitCode`'."

    $exitCodeRef.Value = $processExitCode
  }

  if ($zipExtractLogFullPath) {
    Write-Debug "wrapping 7za invocation with Write-FileUpdateLog"
    Write-FileUpdateLog -logFilePath $zipExtractLogFullPath -locationToMonitor $destination -scriptToRun $unzipOps -argumentList $7zip,$destination32,$fileFullPath32,([ref]$exitCode)
  } else {
    Write-Debug "calling 7za directly"
    Invoke-Command $unzipOps -ArgumentList $7zip,$destination32,$fileFullPath32,([ref]$exitCode)
  }

  Write-Debug "7za exit code: $exitCode"
  switch ($exitCode) {
    0 { break }
    1 { throw 'Some files could not be extracted' } # this one is returned e.g. for access denied errors
    2 { throw '7-Zip encountered a fatal error while extracting the files' }
    7 { throw '7-Zip command line error' }
    8 { throw '7-Zip out of memory' }
    255 { throw 'Extraction cancelled by the user' }
    default { throw "7-Zip signalled an unknown error (code $exitCode)" }
  }

  return $destination
}
tools\chocolateyInstall\helpers\functions\Get-ChocolateyWebFile.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Get-ChocolateyWebFile {
<#
.SYNOPSIS
Downloads a file from the internets.

.DESCRIPTION
This will download a file from a url, tracking with a progress bar.
It returns the filepath to the downloaded file when it is complete.

.PARAMETER PackageName
The name of the package we want to download - this is arbitrary, call it whatever you want.
It's recommended you call it the same as your nuget package id.

.PARAMETER FileFullPath
This is the full path of the resulting file name.

.PARAMETER Url
This is the url to download the file from.

.PARAMETER Url64bit
OPTIONAL - If there is an x64 installer to download, please include it here. If not, delete this parameter

.PARAMETER Checksum
OPTIONAL (Right now) - This allows a checksum to be validated for files that are not local

.PARAMETER Checksum64
OPTIONAL (Right now) - This allows a checksum to be validated for files that are not local

.PARAMETER ChecksumType
OPTIONAL (Right now) - 'md5', 'sha1', 'sha256' or 'sha512' - defaults to 'md5'

.PARAMETER ChecksumType64
OPTIONAL (Right now) - 'md5', 'sha1', 'sha256' or 'sha512' - defaults to ChecksumType

.EXAMPLE
Get-ChocolateyWebFile '__NAME__' 'C:\somepath\somename.exe' 'URL' '64BIT_URL_DELETE_IF_NO_64BIT'

.NOTES
This helper reduces the number of lines one would have to write to download a file to 1 line.
There is no error handling built into this method.

.LINK
Install-ChocolateyPackage
#>
param(
  [string] $packageName,
  [string] $fileFullPath,
  [string] $url,
  [string] $url64bit = '',
  [string] $checksum = '',
  [string] $checksumType = '',
  [string] $checksum64 = '',
  [string] $checksumType64 = $checksumType
)
  Write-Debug "Running 'Get-ChocolateyWebFile' for $packageName with url:`'$url`', fileFullPath:`'$fileFullPath`', url64bit:`'$url64bit`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`'";

  $url32bit = $url;
  $checksum32 = $checksum
  $checksumType32 = $checksumType
  $bitWidth = 32
  if (Get-ProcessorBits 64) {
    $bitWidth = 64
  }
  Write-Debug "CPU is $bitWidth bit"

  $bitPackage = 32
  if ($bitWidth -eq 64 -and $url64bit -ne $null -and $url64bit -ne '') {
    Write-Debug "Setting url to '$url64bit' and bitPackage to $bitWidth"
    $bitPackage = $bitWidth
    $url = $url64bit;
    # only set if urls are different
    if ($url32bit -ne $url64bit) {
      $checksum = $checksum64
	  if ($checkSumType64 -ne '') {
        $checksumType = $checksumType64
	  }
    }
  }

  try {
    $fileDirectory = $([System.IO.Path]::GetDirectoryName($fileFullPath))
    if (!(Test-Path($fileDirectory))) {
      [System.IO.Directory]::CreateDirectory($fileDirectory) | Out-Null  
    }
  } catch {
    Write-Host "Attempt to create directory failed for '$fileFullPath'."
  }

  $forceX86 = $env:chocolateyForceX86;
  if ($forceX86) {
    Write-Debug "User specified -x86 so forcing 32 bit"
    $bitPackage = 32
    $url = $url32bit
    $checksum =  $checksum32
    $checksumType = $checksumType32
  }

  $headers = @{}
  if ($url.StartsWith('http')) {
    try {
      $headers = Get-WebHeaders $url
    } catch {
      if ($host.Version -lt (new-object 'Version' 3,0)) {
        Write-Debug "Converting Security Protocol to SSL3 only for Powershell v2"
        # this should last for the entire duration
        [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Ssl3
        $headers = Get-WebHeaders $url
      } else {
        Write-Host "Attempt to get headers for $url failed.`n  $($_.Exception.Message)"
      }
    }

    $needsDownload = $true
    if ($headers.Count -ne 0 -and $headers.ContainsKey("Content-Length")) {
      $fi = new-object System.IO.FileInfo($fileFullPath)
      # if the file already exists there is no reason to download it again.
      if ($fi.Exists -and $fi.Length -eq $headers["Content-Length"]) {
        Write-Debug "$($packageName)'s requested file has already been downloaded. Using cached copy at
  `'$fileFullPath`'."
        $needsDownload = $false
      }
    }

    if ($needsDownload) {
      Write-Host "Downloading $packageName $bitPackage bit
  from `'$url`'"
      Get-WebFile $url $fileFullPath
    }
  } elseif ($url.StartsWith('ftp')) {
    Write-Host "Ftp-ing $packageName
  from `'$url`'"
    Get-FtpFile $url $fileFullPath
  } else {
    if ($url.StartsWith('file:')) { $url = ([uri] $url).LocalPath }
    Write-Host "Copying $packageName
  from `'$url`'"
    Copy-Item $url -Destination $fileFullPath -Force
  }

  Start-Sleep 2 #give it a sec or two to finish up copying

  $fi = new-object System.IO.FileInfo($fileFullPath)
  # validate file exists
  if (!($fi.Exists)) { throw "Chocolatey expected a file to be downloaded to `'$fileFullPath`' but nothing exists at that location." }
  if ($headers.Count -ne 0) {
    # validate length is what we expected
    Write-Debug "Checking that `'$fileFullPath`' is the size we expect it to be."
    if ($headers.ContainsKey("Content-Length") -and ($fi.Length -ne $headers["Content-Length"]))  { throw "Chocolatey expected a file at `'$fileFullPath`' to be of length `'$($headers["Content-Length"])`' but the length was `'$($fi.Length)`'." }

    if ($headers.ContainsKey("X-Checksum-Sha1")) {
      $remoteChecksum = $headers["X-Checksum-Sha1"]
      Write-Debug "Verifying remote checksum of `'$remoteChecksum`' for `'$fileFullPath`'."
      Get-CheckSumValid -file $fileFullPath -checkSum $remoteChecksum -checksumType 'sha1'
    }
  }

  Write-Debug "Verifying package provided checksum of `'$checksum`' for `'$fileFullPath`'."
  Get-CheckSumValid -file $fileFullPath -checkSum $checksum -checksumType $checksumType

  # Virus check is not able to be performed, must note that.
  # $url is already set properly to the used location.
  #Write-Debug "Verifying downloaded file is not known to contain viruses. FilePath: `'$fileFullPath`'."
  #Get-VirusCheckValid -location $url -file $fileFullPath
}
tools\chocolateyInstall\helpers\functions\Get-EnvironmentVariable.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Get-EnvironmentVariable([string] $Name, [System.EnvironmentVariableTarget] $Scope) {
    [Environment]::GetEnvironmentVariable($Name, $Scope)
}

# Some enhancements to think about here.
# $machinePath = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Control\Session Manager\Environment\").GetValue("PATH", "", [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames).ToString();
tools\chocolateyInstall\helpers\functions\Get-EnvironmentVariableNames.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Get-EnvironmentVariableNames([System.EnvironmentVariableTarget] $Scope) {
    switch ($Scope) {
        'User' { Get-Item 'HKCU:\Environment' | Select-Object -ExpandProperty Property }
        'Machine' { Get-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' | Select-Object -ExpandProperty Property }
        'Process' { Get-ChildItem Env:\ | Select-Object -ExpandProperty Key }
        default { throw "Unsupported environment scope: $Scope" }
    }
}
tools\chocolateyInstall\helpers\functions\Get-FtpFile.ps1
## Get-FtpFile
##############################################################################################################
## Downloads a file from ftp
## Some code from http://stackoverflow.com/questions/265339/whats-the-best-way-to-automate-secure-ftp-in-powershell
## Additional functionality emulated from http://poshcode.org/417 (Get-WebFile)
## Written by Stephen C. Austin, Pwnt & Co. http://pwnt.co
##############################################################################################################
function Get-FtpFile {
param(
  $url = '', #(Read-Host "The URL to download"),
  $fileName = $null,
  $username = $null,
  $password = $null,
  [switch]$quiet
)
  # Create a FTPWebRequest object to handle the connection to the ftp server
  $ftprequest = [System.Net.FtpWebRequest]::create($url)

  # set the request's network credentials for an authenticated connection
  $ftprequest.Credentials =
    New-Object System.Net.NetworkCredential($username,$password)

  $ftprequest.Method = [System.Net.WebRequestMethods+Ftp]::DownloadFile
  $ftprequest.UseBinary = $true
  $ftprequest.KeepAlive = $false

  # send the ftp request to the server
  $ftpresponse = $ftprequest.GetResponse()
  [int]$goal = $ftpresponse.ContentLength

  # get a download stream from the server response
  $reader = $ftpresponse.GetResponseStream()

  # create the target file on the local system and the download buffer
  $writer = New-Object IO.FileStream ($fileName,[IO.FileMode]::Create)
  [byte[]]$buffer = New-Object byte[] 1024
    [int]$total = [int]$count = 0

  # loop through the download stream and send the data to the target file
  do{
    $count = $reader.Read($buffer, 0, $buffer.Length);
    $writer.Write($buffer, 0, $count);
    if(!$quiet) {
      $total += $count
      if($goal -gt 0) {
        Write-Progress "Downloading $url to $fileName" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100)
      } else {
        Write-Progress "Downloading $url to $fileName" "Saving $total bytes..." -id 0 -Completed
      }
      if ($total -eq $goal) {
        Write-Progress "Completed download of $url." "Completed a total of $total bytes of $fileName" -id 0 -Completed
      }
    }
  } while ($count -ne 0)

  $writer.Flush()
  $writer.close()
}
tools\chocolateyInstall\helpers\functions\Get-ProcessorBits.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Get-ProcessorBits {
<#
.SYNOPSIS
Get the system architecture address width.

.DESCRIPTION
This will return the system architecture address width (probably 32 or 64 bit).

.PARAMETER compare
This optional parameter causes the function to return $True or $False, depending on wether or not the bitwidth matches.

.NOTES
When your installation script has to know what architecture it is run on, this simple function comes in handy.
#>
param(
  $compare # You can optionally pass a value to compare the system architecture and receive $True or $False in stead of 32|64|nn
)
  Write-Debug "Running 'Get-ProcessorBits'"

  $bits = 64
  if ([System.IntPtr]::Size -eq 4) {
    $bits = 32
  }

  # Return bool|int
  if ("$compare" -ne '' -and $compare -eq $bits) {
    return $true
  } elseif ("$compare" -ne '') {
    return $false
  } else {
    return $bits
  }
}
tools\chocolateyInstall\helpers\functions\Get-UACEnabled.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Get-UACEnabled {
  $uacRegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
  $uacRegValue = "EnableLUA"
  $uacEnabled = $false

  Write-Debug "Running 'Get-UACEnabled'";


  # http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx
  $osVersion = [Environment]::OSVersion.Version
  if ($osVersion -ge [Version]'6.0')
  {
    $uacRegSetting = Get-ItemProperty -Path $uacRegPath
    try {
      $uacValue = $uacRegSetting.EnableLUA
      if ($uacValue -eq 1) {
        $uacEnabled = $true
      }
    } catch {
      #regkey doesn't exist, so proceed with false

    }
  }

 return $uacEnabled
}
tools\chocolateyInstall\helpers\functions\Get-VirusCheckValid.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Get-VirusCheckValid {
param(
  [string] $location,
  [string] $file = ''
)
  Write-Debug "Running 'Get-VirusCheckValid' with location:`'$location`', file: `'$file`'";

  Write-Debug "Right now there is no virus checking built in."
  #if ($settings:virusCheck) {

  #}

  #if virus check is invalid, throw here
}
tools\chocolateyInstall\helpers\functions\Get-WebFile.ps1
# http://poshcode.org/417
## Get-WebFile (aka wget for PowerShell)
##############################################################################################################
## Downloads a file or page from the web
## History:
## v3.6 - Add -Passthru switch to output TEXT files
## v3.5 - Add -Quiet switch to turn off the progress reports ...
## v3.4 - Add progress report for files which don't report size
## v3.3 - Add progress report for files which report their size
## v3.2 - Use the pure Stream object because StreamWriter is based on TextWriter:
##        it was messing up binary files, and making mistakes with extended characters in text
## v3.1 - Unwrap the filename when it has quotes around it
## v3   - rewritten completely using HttpWebRequest + HttpWebResponse to figure out the file name, if possible
## v2   - adds a ton of parsing to make the output pretty
##        added measuring the scripts involved in the command, (uses Tokenizer)
##############################################################################################################
function Get-WebFile {
param(
  $url = '', #(Read-Host "The URL to download"),
  $fileName = $null,
  $userAgent = 'chocolatey command line',
  [switch]$Passthru,
  [switch]$quiet
)
  Write-Debug "Running 'Get-WebFile' for $fileName with url:`'$url`', userAgent: `'$userAgent`' ";
  #if ($url -eq '' return)
  $req = [System.Net.HttpWebRequest]::Create($url);
  $defaultCreds = [System.Net.CredentialCache]::DefaultCredentials
  if ($defaultCreds -ne $null) {
    $req.Credentials = $defaultCreds
  }

  $webclient = new-object System.Net.WebClient
  if ($defaultCreds -ne $null) {
    $webClient.Credentials = $defaultCreds
  }

  # check if a proxy is required
  $explicitProxy = $env:chocolateyProxyLocation
  $explicitProxyUser = $env:chocolateyProxyUser
  $explicitProxyPassword = $env:chocolateyProxyPassword
  if ($explicitProxy -ne $null) {
    # explicit proxy
	$proxy = New-Object System.Net.WebProxy($explicitProxy, $true)
	if ($explicitProxyPassword -ne $null) {
	  $passwd = ConvertTo-SecureString $explicitProxyPassword -AsPlainText -Force
	  $proxy.Credentials = New-Object System.Management.Automation.PSCredential ($explicitProxyUser, $passwd)
	}
    
	Write-Host "Using explicit proxy server '$explicitProxy'."
    $req.Proxy = $proxy
  
  } elseif (!$webclient.Proxy.IsBypassed($url))
  {
	# system proxy (pass through)
    $creds = [net.CredentialCache]::DefaultCredentials
    if ($creds -eq $null) {
      Write-Debug "Default credentials were null. Attempting backup method"
      $cred = get-credential
      $creds = $cred.GetNetworkCredential();
    }
    $proxyaddress = $webclient.Proxy.GetProxy($url).Authority
    Write-Host "Using system proxy server '$proxyaddress'."
    $proxy = New-Object System.Net.WebProxy($proxyaddress)
    $proxy.Credentials = $creds
    $req.Proxy = $proxy
  }

  $req.Accept = "*/*"
  $req.AllowAutoRedirect = $true
  $req.MaximumAutomaticRedirections = 20
  #$req.KeepAlive = $true

  #http://stackoverflow.com/questions/518181/too-many-automatic-redirections-were-attempted-error-message-when-using-a-httpw
  $req.CookieContainer = New-Object System.Net.CookieContainer
  if ($userAgent -ne $null) {
    Write-Debug "Setting the UserAgent to `'$userAgent`'"
    $req.UserAgent = $userAgent
  }

  $res = $req.GetResponse();

  if($fileName -and !(Split-Path $fileName)) {
    $fileName = Join-Path (Get-Location -PSProvider "FileSystem") $fileName
  }
  elseif((!$Passthru -and ($fileName -eq $null)) -or (($fileName -ne $null) -and (Test-Path -PathType "Container" $fileName)))
  {
    [string]$fileName = ([regex]'(?i)filename=(.*)$').Match( $res.Headers["Content-Disposition"] ).Groups[1].Value
    $fileName = $fileName.trim("\/""'")
    if(!$fileName) {
       $fileName = $res.ResponseUri.Segments[-1]
       $fileName = $fileName.trim("\/")
       if(!$fileName) {
          $fileName = Read-Host "Please provide a file name"
       }
       $fileName = $fileName.trim("\/")
       if(!([IO.FileInfo]$fileName).Extension) {
          $fileName = $fileName + "." + $res.ContentType.Split(";")[0].Split("/")[1]
       }
    }
    $fileName = Join-Path (Get-Location -PSProvider "FileSystem") $fileName
  }
  if($Passthru) {
    $encoding = [System.Text.Encoding]::GetEncoding( $res.CharacterSet )
    [string]$output = ""
  }

  if($res.StatusCode -eq 200) {
    [long]$goal = $res.ContentLength
    $reader = $res.GetResponseStream()
    
    if ($fileName) {
      $fileDirectory = $([System.IO.Path]::GetDirectoryName($fileName))
      if (!(Test-Path($fileDirectory))) {
        [System.IO.Directory]::CreateDirectory($fileDirectory) | Out-Null
      }

      try {
        $writer = new-object System.IO.FileStream $fileName, "Create"
      } catch {
        throw $_.Exception
      }
    }
    
    [byte[]]$buffer = new-object byte[] 1048576
    [long]$total = [long]$count = [long]$iterLoop =0

    $originalEAP = $ErrorActionPreference
    $ErrorActionPreference = 'Stop'
    try {
      do
      {
        $count = $reader.Read($buffer, 0, $buffer.Length);
        if($fileName) {
          $writer.Write($buffer, 0, $count);
        }
        
        if($Passthru){
          $output += $encoding.GetString($buffer,0,$count)
        } elseif(!$quiet) {
          $total += $count
          if($goal -gt 0 -and ++$iterLoop%10 -eq 0) {
            Write-Progress "Downloading $url to $fileName" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100)
          }
          
          if ($total -eq $goal) {
            Write-Progress "Completed download of $url." "Completed a total of $total bytes of $fileName" -id 0 -Completed
          }
        }
      } while ($count -gt 0)
    } catch {
      throw $_.Exception
    } finally {
      $ErrorActionPreference = $originalEAP
    }

    $reader.Close()
    if($fileName) {
       $writer.Flush()
       $writer.Close()
    }
    if($Passthru){
       $output
    }
  }
  $res.Close();
}

# this could be cleaned up with http://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
tools\chocolateyInstall\helpers\functions\Get-WebHeaders.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Get-WebHeaders {
param(
  $url = '',
  $userAgent = 'chocolatey command line'
)
  Write-Debug "Running 'Get-WebHeaders' with url:`'$url`', userAgent: `'$userAgent`'";
  if ($url -eq '') { return }

  $request = [System.Net.HttpWebRequest]::Create($url);
  $defaultCreds = [System.Net.CredentialCache]::DefaultCredentials
  if ($defaultCreds -ne $null) {
    $request.Credentials = $defaultCreds
  }

  #$request.Method = "HEAD"
  $client = New-Object System.Net.WebClient
  if ($defaultCreds -ne $null) {
    $client.Credentials = $defaultCreds
  }

  # check if a proxy is required
  $explicitProxy = $env:chocolateyProxyLocation
  $explicitProxyUser = $env:chocolateyProxyUser
  $explicitProxyPassword = $env:chocolateyProxyPassword
  if ($explicitProxy -ne $null) {
    # explicit proxy
  $proxy = New-Object System.Net.WebProxy($explicitProxy, $true)
  if ($explicitProxyPassword -ne $null) {
    $passwd = ConvertTo-SecureString $explicitProxyPassword -AsPlainText -Force
    $proxy.Credentials = New-Object System.Management.Automation.PSCredential ($explicitProxyUser, $passwd)
  }

    Write-Host "Using explicit proxy server '$explicitProxy'."
    $request.Proxy = $proxy
  
  } elseif (!$client.Proxy.IsBypassed($url))
  {
    # system proxy (pass through)
    $creds = [Net.CredentialCache]::DefaultCredentials
    if ($creds -eq $null) {
      Write-Debug "Default credentials were null. Attempting backup method"
      $cred = Get-Credential
      $creds = $cred.GetNetworkCredential();
    }
    $proxyAddress = $client.Proxy.GetProxy($url).Authority
    Write-Host "Using system proxy server '$proxyaddress'."
    $proxy = New-Object System.Net.WebProxy($proxyAddress)
    $proxy.Credentials = $creds
    $request.Proxy = $proxy
  }

  $request.Accept = '*/*'
  $request.AllowAutoRedirect = $true
  $request.MaximumAutomaticRedirections = 20
  #$request.KeepAlive = $true
  $request.Timeout = 20000

  #http://stackoverflow.com/questions/518181/too-many-automatic-redirections-were-attempted-error-message-when-using-a-httpw
  $request.CookieContainer = New-Object System.Net.CookieContainer
  if ($userAgent -ne $null) {
    Write-Debug "Setting the UserAgent to `'$userAgent`'"
    $request.UserAgent = $userAgent
  }

  Write-Debug "Request Headers:"
  foreach ($key in $request.Headers) {
    $value = $request.Headers[$key];
    if ($value) {
      Write-Debug "  `'$key`':`'$value`'"
    } else {
      Write-Debug "  `'$key`'"
    }
  }

  $headers = @{}

  try {
    $response = $request.GetResponse();
    Write-Debug "Response Headers:"
    foreach ($key in $response.Headers) {
      $value = $response.Headers[$key];
      if ($value) {
        $headers.Add("$key","$value")
        Write-Debug "  `'$key`':`'$value`'"
      }
    }
    $response.Close();
  }
  catch {
    $request.ServicePoint.MaxIdleTime = 0
    $request.Abort();
    # ruthlessly remove $request to ensure it isn't reused
    Remove-Variable request
    Start-Sleep 1
    [GC]::Collect()
    throw
  }

  $headers
}
tools\chocolateyInstall\helpers\functions\Install-BinFile.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-BinFile {
param(
  [string] $name,
  [string] $path,
  [switch] $useStart,
  [string] $command = ''
)
  Write-Debug "Running 'Install-BinFile' for $name with path:`'$path`'|`$useStart:$useStart|`$command:$command";

  $nugetPath = [System.IO.Path]::GetFullPath((Join-Path "$helpersPath" '..\'))
  $nugetExePath = Join-Path "$nugetPath" 'bin'
  $packageBatchFileName = Join-Path $nugetExePath "$name.bat"
  $packageBashFileName = Join-Path $nugetExePath "$name"
  $packageShimFileName = Join-Path $nugetExePath "$name.exe"

  if (Test-Path ($packageBatchFileName)) {Remove-Item $packageBatchFileName -force}
  if (Test-Path ($packageBashFileName)) {Remove-Item $packageBashFileName -force}
  $originalPath = $path
  $path = $path.ToLower().Replace($nugetPath.ToLower(), "..\").Replace("\\","\")

  $ShimGenArgs = "-o `"$packageShimFileName`" -p `"$path`" -i `"$originalPath`""
  if ($command -ne $null -and $command -ne '') {
    $ShimGenArgs +=" -c $command"
  }

  if ($useStart) {
    $ShimGenArgs +=" -gui"
  }

  if ($debug) {
    $ShimGenArgs +=" -debug"
  }

  $ShimGen = Join-Path "$helpersPath" '..\tools\shimgen.exe'
  if (!([System.IO.File]::Exists($ShimGen))) {
	  Update-SessionEnvironment
	  $ShimGen = Join-Path "$env:ChocolateyInstall" 'tools\shimgen.exe'
  }
  
  $ShimGen = [System.IO.Path]::GetFullPath($ShimGen)
  Write-Debug "ShimGen found at `'$ShimGen`'"

  Write-Debug "Calling $ShimGen $ShimGenArgs"

  if (Test-Path ("$ShimGen")) {
    #Start-Process "$ShimGen" -ArgumentList "$ShimGenArgs" -Wait -WindowStyle Hidden
    $process = New-Object System.Diagnostics.Process
    $process.StartInfo = new-object System.Diagnostics.ProcessStartInfo($ShimGen, $ShimGenArgs)
    $process.StartInfo.RedirectStandardOutput = $true
    $process.StartInfo.RedirectStandardError = $true
    $process.StartInfo.UseShellExecute = $false
    $process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden

    $process.Start() | Out-Null
    $process.WaitForExit()
  }

  if (Test-Path ($packageShimFileName)) {
    Write-Host "Added $packageShimFileName shim pointed to `'$path`'."
  } else {
    Write-Warning "An error occurred generating shim, using old method."

    $path = "%DIR%$($path)"
    $pathBash = $path.Replace("%DIR%..\","`$DIR/../").Replace("\","/")
    Write-Host "Adding $packageBatchFileName and pointing to `'$path`'."
    Write-Host "Adding $packageBashFileName and pointing to `'$path`'."
    if ($useStart) {
      Write-Host "Setting up $name as a non-command line application."
"@echo off
SET DIR=%~dp0%
start """" ""$path"" %*" | Out-File $packageBatchFileName -encoding ASCII

      $sw = New-Object IO.StreamWriter "$packageBashFileName"
      $sw.Write("#!/bin/sh`nDIR=`${0%/*}`n""$pathBash"" ""`$@"" &`n")
      $sw.Close()
      $sw.Dispose()
    } else {

"@echo off
SET DIR=%~dp0%
cmd /c """"$path"" %*""
exit /b %ERRORLEVEL%" | Out-File $packageBatchFileName -encoding ASCII

      $sw = New-Object IO.StreamWriter "$packageBashFileName"
      $sw.Write("#!/bin/sh`nDIR=`${0%/*}`n""$pathBash"" ""`$@""`nexit `$?`n")
      $sw.Close()
      $sw.Dispose()

    }
  }
}

Set-Alias Generate-BinFile Install-BinFile
Set-Alias Add-BinFile Install-BinFile
tools\chocolateyInstall\helpers\functions\Install-ChocolateyDesktopLink.ps1
tools\chocolateyInstall\helpers\functions\Install-ChocolateyEnvironmentVariable.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyEnvironmentVariable {
<#
.SYNOPSIS
Creates a persistent environment variable

.DESCRIPTION
Install-ChocolateyEnvironmentVariable creates an environment variable
with the specified name and value. The variable is persistent and
will remain after reboots and accross multiple powershell and command
line sessions. The variable can be scoped either to the user or to
the machine. If machine level scoping is specified, the comand is
elevated to an administrative session.

.PARAMETER variableName
The name or key of the environment variable

.PARAMETER variableValue
A string value assigned to the above name.

.PARAMETER variableType
Specifies whether this variable is to be accesible at either the
individual user level or at the Machine level.

.EXAMPLE
Install-ChocolateyEnvironmentVariable "JAVA_HOME" "d:\oracle\jdk\bin"
Creates a User environmet variable "JAVA_HOME" pointing to
"d:\oracle\jdk\bin".

.EXAMPLE
Install-ChocolateyEnvironmentVariable "_NT_SYMBOL_PATH" "symsrv*symsrv.dll*f:\localsymbols*http://msdl.microsoft.com/download/symbols" Machine
Creates a User environmet variable "_NT_SYMBOL_PATH" pointing to
"symsrv*symsrv.dll*f:\localsymbols*http://msdl.microsoft.com/download/symbols".
The command will be elevated to admin priviledges.

#>
param(
  [string] $variableName,
  [string] $variableValue,
  [System.EnvironmentVariableTarget] $variableType = [System.EnvironmentVariableTarget]::User
)
  Write-Debug "Running 'Install-ChocolateyEnvironmentVariable' with variableName:`'$variableName`' and variableValue:`'$variableValue`'";

  if ($variableType -eq [System.EnvironmentVariableTarget]::Machine) {
    if (Test-ProcessAdminRights) {
      Set-EnvironmentVariable -Name $variableName -Value $variableValue -Scope $variableType
    } else {
      $psArgs = "Install-ChocolateyEnvironmentVariable -variableName `'$variableName`' -variableValue `'$variableValue`' -variableType `'$variableType`'"
      Start-ChocolateyProcessAsAdmin "$psArgs"
    }
  } else {
    Set-EnvironmentVariable -Name $variableName -Value $variableValue -Scope $variableType
  }

  Set-Content env:\$variableName $variableValue
}
tools\chocolateyInstall\helpers\functions\Install-ChocolateyExplorerMenuItem.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyExplorerMenuItem {
<#
.SYNOPSIS
Creates a windows explorer context menu item that can be associated with a command

.DESCRIPTION
Install-ChocolateyExplorerMenuItem can add an entry in the context menu of
Windows Explorer. The menu item is given a text label and a command. The command
can be any command accepted on the windows command line. The menu item can be
applied to either folder items or file items.

Because this command accesses and edits the root class registry node, it will be
elevated to admin.

.PARAMETER MenuKey
A unique string to identify this menu item in the registry

.PARAMETER MenuLabel
The string that will be displayed in the context menu

.PARAMETER Command
A command line command that will be invoked when the menu item is selected

.PARAMETER Type
Specifies if the menu item should be applied to a folder or a file

.EXAMPLE
C:\PS>$sublimeDir = (Get-ChildItem $env:ALLUSERSPROFILE\chocolatey\lib\sublimetext* | select $_.last)
C:\PS>$sublimeExe = "$sublimeDir\tools\sublime_text.exe"
C:\PS>Install-ChocolateyExplorerMenuItem "sublime" "Open with Sublime Text 2" $sublimeExe

This will create a context menu item in Windows Explorer when any file is right clicked. The menu item will appear with the text "Open with Sublime Text 2" and will invoke sublime text 2 when selected.
.EXAMPLE
C:\PS>$sublimeDir = (Get-ChildItem $env:ALLUSERSPROFILE\chocolatey\lib\sublimetext* | select $_.last)
C:\PS>$sublimeExe = "$sublimeDir\tools\sublime_text.exe"
C:\PS>Install-ChocolateyExplorerMenuItem "sublime" "Open with Sublime Text 2" $sublimeExe "directory"

This will create a context menu item in Windows Explorer when any folder is right clicked. The menu item will appear with the text "Open with Sublime Text 2" and will invoke sublime text 2 when selected.

.NOTES
Chocolatey will automatically add the path of the file or folder clicked to the command. This is done simply by appending a %1 to the end of the command.
#>
param(
  [string]$menuKey,
  [string]$menuLabel,
  [string]$command,
  [ValidateSet('file','directory')]
  [string]$type = "file"
)
try {
  Write-Debug "Running 'Install-ChocolateyExplorerMenuItem' with menuKey:'$menuKey', menuLabel:'$menuLabel', command:'$command', type '$type'"
  if($type -eq "file") {$key = "*"} elseif($type -eq "directory") {$key="directory"} else{ return 1}
  $elevated = "`
    if( -not (Test-Path -path HKCR:) ) {New-PSDrive -Name HKCR -PSProvider registry -Root Hkey_Classes_Root};`
    if(!(test-path -LiteralPath 'HKCR:\$key\shell\$menuKey')) { new-item -Path 'HKCR:\$key\shell\$menuKey' };`
    Set-ItemProperty -LiteralPath 'HKCR:\$key\shell\$menuKey' -Name '(Default)'  -Value '$menuLabel';`
    if(!(test-path -LiteralPath 'HKCR:\$key\shell\$menuKey\command')) { new-item -Path 'HKCR:\$key\shell\$menuKey\command' };`
    Set-ItemProperty -LiteralPath 'HKCR:\$key\shell\$menuKey\command' -Name '(Default)' -Value '$command \`"%1\`"';`
    return 0;"

  Start-ChocolateyProcessAsAdmin $elevated
  Write-Host "'$menuKey' explorer menu item has been created"
}
catch {
    $errorMessage = "'$menuKey' explorer menu item was not created - $($_.Exception.Message)"
	Write-Warning $errorMessage
  }
}
tools\chocolateyInstall\helpers\functions\Install-ChocolateyFileAssociation.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyFileAssociation {
<#
.SYNOPSIS
Creates an association between a file extension and a executable

.DESCRIPTION
Install-ChocolateyFileAssociation can associate a file extension
with a downloaded application. Once this command has created an
association, all invocations of files with the specified extension
will be opened via the executable specified.

This command will run with elevated privileges.

.PARAMETER Extension
The file extension to be associated.

.PARAMETER Executable
The path to the application's executable to be associated.

.EXAMPLE
C:\PS>$sublimeDir = (Get-ChildItem $env:ALLUSERSPROFILE\chocolatey\lib\sublimetext* | select $_.last)
C:\PS>$sublimeExe = "$sublimeDir\tools\sublime_text.exe"
C:\PS>Install-ChocolateyFileAssociation ".txt" $sublimeExe

This will create an association between Sublime Text 2 and all .txt files. Any .txt file opened will by default open with Sublime Text 2.

#>
param(
  [string] $extension,
  [string] $executable
)
  Write-Debug "Running 'Install-ChocolateyFileAssociation' associating $extension with `'$executable`'";
  if(-not(Test-Path $executable)){
    $errorMessage = "`'$executable`' does not exist, not able to create association"
    Write-Error $errorMessage
    throw $errorMessage
  }
  $extension=$extension.trim()
  if(-not($extension.StartsWith("."))) {
      $extension = ".$extension"
  }
  $fileType = Split-Path $executable -leaf
  $fileType = $fileType.Replace(" ","_")
  $elevated = @"
    cmd /c "assoc $extension=$fileType"
    cmd /c 'ftype $fileType="$executable" "%1" "%*"'
    New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
    Set-ItemProperty -Path "HKCR:\$fileType" -Name "(Default)" -Value "$fileType file" -ErrorAction Stop
"@
  Start-ChocolateyProcessAsAdmin $elevated
  Write-Host "`'$extension`' has been associated with `'$executable`'"
}
tools\chocolateyInstall\helpers\functions\Install-ChocolateyInstallPackage.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyInstallPackage {
<#
.SYNOPSIS
Installs a package

.DESCRIPTION
This will run an installer (local file) on your machine.

.PARAMETER PackageName
The name of the package - this is arbitrary, call it whatever you want.
It's recommended you call it the same as your nuget package id.

.PARAMETER FileType
This is the extension of the file. This should be either exe or msi.

.PARAMETER SilentArgs
OPTIONAL - These are the parameters to pass to the native installer.
Try any of these to get the silent installer - /s /S /q /Q /quiet /silent /SILENT /VERYSILENT
With msi it is always /quiet.
If you don't pass anything it will invoke the installer with out any arguments. That means a nonsilent installer.

Please include the notSilent tag in your chocolatey nuget package if you are not setting up a silent package.

.PARAMETER File
The full path to the native installer to run

.EXAMPLE
Install-ChocolateyInstallPackage '__NAME__' 'EXE_OR_MSI' 'SILENT_ARGS' 'FilePath'

.OUTPUTS
None

.NOTES
This helper reduces the number of lines one would have to write to run an installer to 1 line.
There is no error handling built into this method.

.LINK
Install-ChocolateyPackage
#>
param(
  [string] $packageName,
  [alias("installerType")][string] $fileType = 'exe',
  [string] $silentArgs = '',
  [string] $file,
  $validExitCodes = @(0)
)
  Write-Debug "Running 'Install-ChocolateyInstallPackage' for $packageName with file:`'$file`', args: `'$silentArgs`', fileType: `'$fileType`', validExitCodes: `'$validExitCodes`' ";
  $installMessage = "Installing $packageName..."
  write-host $installMessage

  $ignoreFile = $file + '.ignore'
  try {
    '' | out-file $ignoreFile
  } catch {
    Write-Warning "Unable to generate `'$ignoreFile`'"
  }

  $additionalInstallArgs = $env:chocolateyInstallArguments;
  if ($additionalInstallArgs -eq $null) { $additionalInstallArgs = ''; }
  $overrideArguments = $env:chocolateyInstallOverride;

  if ($fileType -like 'msi') {
    $msiArgs = "/i `"$file`""
    if ($overrideArguments) {
      $msiArgs = "$msiArgs $additionalInstallArgs";
      write-host "Overriding package arguments with `'$additionalInstallArgs`'";
    } else {
      $msiArgs = "$msiArgs $silentArgs $additionalInstallArgs";
    }

    Start-ChocolateyProcessAsAdmin "$msiArgs" 'msiexec' -validExitCodes $validExitCodes
    #Start-Process -FilePath msiexec -ArgumentList $msiArgs -Wait
  }
  if ($fileType -like 'exe') {
    if ($overrideArguments) {
      Start-ChocolateyProcessAsAdmin "$additionalInstallArgs" $file -validExitCodes $validExitCodes
      write-host "Overriding package arguments with `'$additionalInstallArgs`'";
    } else {
      Start-ChocolateyProcessAsAdmin "$silentArgs $additionalInstallArgs" $file -validExitCodes $validExitCodes
    }
  }

  if($fileType -like 'msu') {

    if ($overrideArguments) {
      $msuArgs = "$file $additionalInstallArgs"
    } else {
      $msuArgs = "$file $silentArgs $additionalInstallArgs"
    }
    Start-ChocolateyProcessAsAdmin "$msuArgs" 'wusa.exe' -validExitCodes $validExitCodes
  }

  write-host "$packageName has been installed."
}
tools\chocolateyInstall\helpers\functions\Install-ChocolateyPackage.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyPackage {
<#
.SYNOPSIS
Installs a package

.DESCRIPTION
This will download a file from a url and install it on your machine.

.PARAMETER PackageName
The name of the package we want to download - this is arbitrary, call it whatever you want.
It's recommended you call it the same as your nuget package id.

.PARAMETER FileType
This is the extension of the file. This should be either exe or msi.

.PARAMETER SilentArgs
OPTIONAL - These are the parameters to pass to the native installer.
Try any of these to get the silent installer - /s /S /q /Q /quiet /silent /SILENT /VERYSILENT
With msi it is always /quiet. Please pass it in still but it will be overridden by chocolatey to /quiet.
If you don't pass anything it will invoke the installer with out any arguments. That means a nonsilent installer.

Please include the notSilent tag in your chocolatey nuget package if you are not setting up a silent package.

.PARAMETER Url
This is the url to download the file from.

.PARAMETER Url64bit
OPTIONAL - If there is an x64 installer to download, please include it here. If not, delete this parameter

.PARAMETER Checksum
OPTIONAL (Right now) - This allows a checksum to be validated for files that are not local

.PARAMETER Checksum64
OPTIONAL (Right now) - This allows a checksum to be validated for files that are not local

.PARAMETER ChecksumType
OPTIONAL (Right now) - 'md5', 'sha1', 'sha256' or 'sha512' - defaults to 'md5'

.PARAMETER ChecksumType64
OPTIONAL (Right now) - 'md5', 'sha1', 'sha256' or 'sha512' - defaults to ChecksumType


.EXAMPLE
Install-ChocolateyPackage '__NAME__' 'EXE_OR_MSI' 'SILENT_ARGS' 'URL' '64BIT_URL_DELETE_IF_NO_64BIT'

.OUTPUTS
None

.NOTES
This helper reduces the number of lines one would have to write to download and install a file to 1 line.
This method has error handling built into it.

.LINK
Get-ChocolateyWebFile
Install-ChocolateyInstallPackage
#>
param(
  [string] $packageName,
  [alias("installerType")][string] $fileType = 'exe',
  [string] $silentArgs = '',
  [string] $url,
  [alias("url64")][string] $url64bit = '',
  $validExitCodes = @(0),
  [string] $checksum = '',
  [string] $checksumType = '',
  [string] $checksum64 = '',
  [string] $checksumType64 = ''
)

  Write-Debug "Running 'Install-ChocolateyPackage' for $packageName with url:`'$url`', args: `'$silentArgs`', fileType: `'$fileType`', url64bit: `'$url64bit`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`', validExitCodes: `'$validExitCodes`' ";

  $chocTempDir = Join-Path $env:TEMP "chocolatey"
  $tempDir = Join-Path $chocTempDir "$packageName"
  if ($env:packageVersion -ne $null) {$tempDir = Join-Path $tempDir "$env:packageVersion"; }

  if (![System.IO.Directory]::Exists($tempDir)) { [System.IO.Directory]::CreateDirectory($tempDir) | Out-Null }
  $file = Join-Path $tempDir "$($packageName)Install.$fileType"

  Get-ChocolateyWebFile $packageName $file $url $url64bit -checksum $checksum -checksumType $checksumType -checksum64 $checksum64 -checksumType64 $checksumType64
  Install-ChocolateyInstallPackage $packageName $fileType $silentArgs $file -validExitCodes $validExitCodes
}
tools\chocolateyInstall\helpers\functions\Install-ChocolateyPath.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyPath {
param(
  [string] $pathToInstall,
  [System.EnvironmentVariableTarget] $pathType = [System.EnvironmentVariableTarget]::User
)
  Write-Debug "Running 'Install-ChocolateyPath' with pathToInstall:`'$pathToInstall`'";
  $originalPathToInstall = $pathToInstall

  #get the PATH variable
  Update-SessionEnvironment
  $envPath = $env:PATH
  if (!$envPath.ToLower().Contains($pathToInstall.ToLower()))
  {
    Write-Host "PATH environment variable does not have $pathToInstall in it. Adding..."
    $actualPath = Get-EnvironmentVariable -Name 'Path' -Scope $pathType

    $statementTerminator = ";"
    #does the path end in ';'?
    $hasStatementTerminator = $actualPath -ne $null -and $actualPath.EndsWith($statementTerminator)
    # if the last digit is not ;, then we are adding it
    If (!$hasStatementTerminator -and $actualPath -ne $null) {$pathToInstall = $statementTerminator + $pathToInstall}
    if (!$pathToInstall.EndsWith($statementTerminator)) {$pathToInstall = $pathToInstall + $statementTerminator}
    $actualPath = $actualPath + $pathToInstall

    if ($pathType -eq [System.EnvironmentVariableTarget]::Machine) {
      if (Test-ProcessAdminRights) {
        Set-EnvironmentVariable -Name 'Path' -Value $actualPath -Scope $pathType
      } else {
        $psArgs = "Install-ChocolateyPath -pathToInstall `'$originalPathToInstall`' -pathType `'$pathType`'"
        Start-ChocolateyProcessAsAdmin "$psArgs"
      }
    } else {
      Set-EnvironmentVariable -Name 'Path' -Value $actualPath -Scope $pathType
    }

    #add it to the local path as well so users will be off and running
    $envPSPath = $env:PATH
    $env:Path = $envPSPath + $statementTerminator + $pathToInstall
  }
}

# [System.Text.RegularExpressions.Regex]::Match($Path,[System.Text.RegularExpressions.Regex]::Escape('locationtoMatch') + '(?>;)?', '', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
tools\chocolateyInstall\helpers\functions\Install-ChocolateyPinnedTaskBarItem.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyPinnedTaskBarItem {
<#
.SYNOPSIS
Creates an item in the task bar linking to the provided path.

.PARAMETER TargetFilePath
The path to the application that should be launched when clicking on the task bar icon.

.EXAMPLE
Install-ChocolateyPinnedTaskBarItem "${env:ProgramFiles(x86)}\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe"

This will create a Visual Studio task bar icon.

#>
param(
  [string] $targetFilePath
)

  Write-Debug "Running 'Install-ChocolateyPinnedTaskBarItem' with targetFilePath:`'$targetFilePath`'";
  
  try{
	if (test-path($targetFilePath)) {
		$verb = "Pin To Taskbar"
		$path= split-path $targetFilePath 
		$shell=new-object -com "Shell.Application"  
		$folder=$shell.Namespace($path)    
		$item = $folder.Parsename((split-path $targetFilePath -leaf)) 
		$itemVerb = $item.Verbs() | ? {$_.Name.Replace("&","") -eq $verb} 
		if($itemVerb -eq $null){ 
			Write-Host "TaskBar verb not found for $item. It may have already been pinned"
		} else { 
			$itemVerb.DoIt() 
		} 
		Write-Host "`'$targetFilePath`' has been pinned to the task bar on your desktop"
	} else {
		$errorMessage = "`'$targetFilePath`' does not exist, not able to pin to task bar"
	}

	if ($errorMessage) {
		Write-Warning $errorMessage
	}
  } catch {
	 Write-Warning "Unable to create pin. Error captured was $($_.Exception.Message)."
  }
}
tools\chocolateyInstall\helpers\functions\Install-ChocolateyPowershellCommand.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyPowershellCommand {
param(
  [string] $packageName,
  [string] $psFileFullPath,
  [string] $url ='',
  [alias("url64")][string] $url64bit = '',
  [string] $checksum = '',
  [string] $checksumType = '',
  [string] $checksum64 = '',
  [string] $checksumType64 = ''
)
  Write-Debug "Running 'Install-ChocolateyPowershellCommand' for $packageName with psFileFullPath:`'$psFileFullPath`', url: `'$url`', url64bit:`'$url64bit`', checkSum: `'$checksum`', checksumType: `'$checksumType`', checkSum64: `'$checksum64`', checksumType64: `'$checksumType64`' ";
  
  if ($url -ne '') {
  Get-ChocolateyWebFile $packageName $psFileFullPath $url $url64bit -checksum $checksum -checksumType $checksumType -checksum64 $checksum64 -checksumType64 $checksumType64
  }
  
  $nugetPath = $(Split-Path -parent $helpersPath)
  $nugetExePath = Join-Path $nuGetPath 'bin'
  
  $cmdName = [System.IO.Path]::GetFileNameWithoutExtension($psFileFullPath)
  $packageBatchFileName = Join-Path $nugetExePath "$($cmdName).bat"
  
  Write-Host "Adding $packageBatchFileName and pointing it to powershell command $psFileFullPath"
"@echo off
powershell -NoProfile -ExecutionPolicy unrestricted -Command ""& `'$psFileFullPath`'  %*"""| Out-File $packageBatchFileName -encoding ASCII

}
tools\chocolateyInstall\helpers\functions\Install-ChocolateyShortcut.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyShortcut {
<#
.SYNOPSIS
This adds a shortcut, at the specified location, with the option to specify 
a number of additional properties for the shortcut, such as Working Directory,
Arguments, Icon Location, and Description.

.PARAMETER ShortcutFilePath
The full absolute path to where the shortcut should be created.  This is mandatory.

.PARAMETER TargetPath
The full absolute path to the target for new shortcut.  This is mandatory.

.PARAMETER WorkingDirectory
The full absolute path of the Working Directory that will be used by 
the new shortcut.  This is optional

.PARAMETER Arguments
Additonal arguments that should be passed along to the new shortcut.  This 
is optional.

.PARAMETER IconLocation
The full absolute path to an icon file to be used for the new shortcut.  This
is optional.

.PARAMETER Description
A text description to be associated with the new description.  This is optional.

.EXAMPLE
Install-ChocolateyShortcut -shortcutFilePath "C:\test.lnk" -targetPath "C:\test.exe"

This will create a new shortcut at the location of "C:\test.lnk" and link to the file
located at "C:\text.exe"

.EXAMPLE
Install-ChocolateyShortcut -shortcutFilePath "C:\notepad.lnk" -targetPath "C:\Windows\System32\notepad.exe" -workDirectory "C:\" -arguments "C:\test.txt" -iconLocation "C:\test.ico" -description "This is the description"

This will create a new shortcut at the location of "C:\notepad.lnk" and link to the
Notepad application.  In addition, other properties are being set to specify the working 
directoy, an icon to be used for the shortcut, along with a description and arguments.

#>
	param(
	  [string] $shortcutFilePath,
	  [string] $targetPath,
	  [string] $workingDirectory,
	  [string] $arguments,
	  [string] $iconLocation,
	  [string] $description
	)

	Write-Debug "Running 'Install-ChocolateyShortcut' with parameters ShortcutFilePath: `'$shortcutFilePath`', TargetPath: `'$targetPath`', WorkingDirectory: `'$workingDirectory`', Arguments: `'$arguments`', IconLocation: `'$iconLocation`', Description: `'$description`'";

	if(!$shortcutFilePath) {
	  throw "Install-ChocolateyShortcut - `$shortcutFilePath can not be null."
	}
	
	$shortcutDirectory = $([System.IO.Path]::GetDirectoryName($shortcutFilePath))
	if (!(Test-Path($shortcutDirectory))) {
	  [System.IO.Directory]::CreateDirectory($shortcutDirectory) | Out-Null  
    }

	if(!$targetPath) {
	  throw "Install-ChocolateyShortcut - `$targetFilePath can not be null."
	}
		
	if(!(Test-Path($targetPath))) {
	  Write-Warning "'$targetFilePath' does not exist. If it is not created the shortcut will not be valid."
	}
	
	if($iconLocation) {
		if(!(Test-Path($iconLocation))) {
		  Write-Warning "'$iconLocation' does not exist. A default icon will be used."
		}
	}
	
	if ($workingDirectory) {
	  if (!(Test-Path($workingDirectory))) {
		[System.IO.Directory]::CreateDirectory($workingDirectory) | Out-Null  
      }
	}
	
	Write-Debug "Creating Shortcut..."
	
	try {
		$global:WshShell = New-Object -com "WScript.Shell"
	    $lnk = $global:WshShell.CreateShortcut($shortcutFilePath)
	    $lnk.TargetPath = $targetPath
		$lnk.WorkingDirectory = $workingDirectory
	    $lnk.Arguments = $arguments
	    if($iconLocation) {
	      $lnk.IconLocation = $iconLocation
	    }
		if ($description) {
		  $lnk.Description = $description
		}
	   
	    $lnk.Save()
		
		Write-Debug "Shortcut created."
	}
	catch {
		Write-Warning "Unable to create shortcut. Error captured was $($_.Exception.Message)."
	}
}
tools\chocolateyInstall\helpers\functions\Install-ChocolateyVsixPackage.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyVsixPackage {
<#
.SYNOPSIS
Downloads and installs a VSIX package for Visual Studio

.PARAMETER PackageName
The name of the package we want to download - this is
arbitrary, call it whatever you want. It's recommended
you call it the same as your nuget package id.

.PARAMETER VsixUrl
The URL of the package to be installed

.PARAMETER VsVersion
The Major version number of Visual Studio where the
package should be installed. This is optional. If not
specified, the most recent Visual Studio installation
will be targetted.

.PARAMETER Checksum
OPTIONAL (Right now) - This allows a checksum to be validated for files that are not local

.PARAMETER ChecksumType
OPTIONAL (Right now) - 'md5', 'sha1', 'sha256' or 'sha512' - defaults to 'md5'

.EXAMPLE
Install-ChocolateyVsixPackage "MyPackage" http://visualstudiogallery.msdn.microsoft.com/ea3a37c9-1c76-4628-803e-b10a109e7943/file/73131/1/AutoWrockTestable.vsix

This downloads the AutoWrockTestable VSIX from the Visual Studio Gallery and installs it to the latest version of VS.

.EXAMPLE
Install-ChocolateyVsixPackage "MyPackage" http://visualstudiogallery.msdn.microsoft.com/ea3a37c9-1c76-4628-803e-b10a109e7943/file/73131/1/AutoWrockTestable.vsix 11

This downloads the AutoWrockTestable VSIX from the Visual Studio Gallery and installs it to Visual Studio 2012 (v11.0).

.NOTES
VSIX packages are Extensions for the Visual Studio IDE.
The Visual Sudio Gallery at
http://visualstudiogallery.msdn.microsoft.com/ is the
public extension feed and hosts thousands of extensions.
You can locate a VSIX Url by finding the download link
of Visual Studio extensions on the Visual Studio Gallery.

#>
param(
  [string]$packageName,
  [string]$vsixUrl,
  [int]$vsVersion=0,
  [string] $checksum = '',
  [string] $checksumType = ''
)
    Write-Debug "Running 'Install-ChocolateyVsixPackage' for $packageName with vsixUrl:`'$vsixUrl`', vsVersion: `'$vsVersion`', checksum: `'$checksum`', checksumType: `'$checksumType`' ";
    if($vsVersion -eq 0) {
        if ([System.IntPtr]::Size -eq 4)
        {
            <# 32bits system case #>
            $versions=(get-ChildItem HKLM:SOFTWARE\Microsoft\VisualStudio -ErrorAction SilentlyContinue | ? { ($_.PSChildName -match "^[0-9\.]+$") } | ? {$_.property -contains "InstallDir"} | sort {[int]($_.PSChildName)} -descending)
            
        }
        else
        {
            $versions=(get-ChildItem HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio -ErrorAction SilentlyContinue | ? { ($_.PSChildName -match "^[0-9\.]+$") } | ? {$_.property -contains "InstallDir"} | sort {[int]($_.PSChildName)} -descending)
        }
        if($versions -and $versions.Length){
            $version = $versions[0]
        }elseif($versions){
            $version = $versions
        }
        
    }
    else {
        if ([System.IntPtr]::Size -eq 4)
        {
            <# 32bits system case #>
            $versions=(get-ChildItem HKLM:SOFTWARE\Microsoft\VisualStudio -ErrorAction SilentlyContinue | ? { ($_.PSChildName.EndsWith("$vsVersion.0")) } | ? {$_.property -contains "InstallDir"})
        }
        else
        {
            $version=(get-ChildItem HKLM:SOFTWARE\Wow6432Node\Microsoft\VisualStudio -ErrorAction SilentlyContinue | ? { ($_.PSChildName.EndsWith("$vsVersion.0")) } | ? {$_.property -contains "InstallDir"})
        }
    }
    if($version){
        $vnum=$version.PSPath.Substring($version.PSPath.LastIndexOf('\')+1)
        if($vnum -as [int] -lt 10) {
            throw "This installed VS version, $vnum, does not support installing VSIX packages. Version 10 is the minimum acceptable version."
        }
        $dir=(get-itemProperty $version.PSPath "InstallDir").InstallDir
        $installer = Join-Path $dir "VsixInstaller.exe"
    }
    if($installer) {
        $download="$env:TEMP\$($packageName.Replace(' ','')).vsix"
        try{
            Get-ChocolateyWebFile $packageName $download $vsixUrl -checksum $checksum -checksumType $checksumType
        }
        catch {
            throw "There were errors attempting to retrieve the vsix from $vsixUrl. The error message was '$_'."
        }
        Write-Debug "Installing VSIX using $installer"
        $exitCode = Install-Vsix "$installer" "$download"
        if($exitCode -gt 0 -and $exitCode -ne 1001) { #1001: Already installed
           throw "There was an error installing '$packageName'. The exit code returned was $exitCode."
        }
    }
    else {
        throw "Visual Studio is not installed or the specified version is not present."
    }
}

function Install-Vsix($installer, $installFile) {
    Write-Host "Installing $installFile using $installer"
    $psi = New-Object System.Diagnostics.ProcessStartInfo
    $psi.FileName=$installer
    $psi.Arguments="/q $installFile"
    $s = [System.Diagnostics.Process]::Start($psi)
    $s.WaitForExit()
    return $s.ExitCode
}
tools\chocolateyInstall\helpers\functions\Install-ChocolateyZipPackage.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Install-ChocolateyZipPackage {
<#
.SYNOPSIS
Downloads and unzips a package

.DESCRIPTION
This will download a file from a url and unzip it on your machine.

.PARAMETER PackageName
The name of the package we want to download - this is arbitrary, call it whatever you want.
It's recommended you call it the same as your nuget package id.

.PARAMETER Url
This is the url to download the file from.

.PARAMETER Url64bit
OPTIONAL - If there is an x64 installer to download, please include it here. If not, delete this parameter

.PARAMETER UnzipLocation
This is a location to unzip the contents to, most likely your script folder.

.PARAMETER Checksum
OPTIONAL (Right now) - This allows a checksum to be validated for files that are not local

.PARAMETER Checksum64
OPTIONAL (Right now) - This allows a checksum to be validated for files that are not local

.PARAMETER ChecksumType
OPTIONAL (Right now) - 'md5', 'sha1', 'sha256' or 'sha512' - defaults to 'md5'

.PARAMETER ChecksumType64
OPTIONAL (Right now) - 'md5', 'sha1', 'sha256' or 'sha512' - defaults to ChecksumType

.EXAMPLE
Install-ChocolateyZipPackage '__NAME__' 'URL' "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

.OUTPUTS
None

.NOTES
This helper reduces the number of lines one would have to write to download and unzip a file to 1 line.
This method has error handling built into it.

.LINK
  Get-ChocolateyWebFile
  Get-ChocolateyUnzip
#>
param(
  [string] $packageName,
  [string] $url,
  [string] $unzipLocation,
  [alias("url64")][string] $url64bit = '',
  [string] $specificFolder ="",
  [string] $checksum = '',
  [string] $checksumType = '',
  [string] $checksum64 = '',
  [string] $checksumType64 = ''
)
  Write-Debug "Running 'Install-ChocolateyZipPackage' for $packageName with url:`'$url`', unzipLocation: `'$unzipLocation`', url64bit: `'$url64bit`', specificFolder: `'$specificFolder`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`' ";

  $fileType = 'zip'

  $chocTempDir = Join-Path $env:TEMP "chocolatey"
  $tempDir = Join-Path $chocTempDir "$packageName"
  if ($env:packageVersion -ne $null) {$tempDir = Join-Path $tempDir "$env:packageVersion"; }

  if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir) | Out-Null}
  $file = Join-Path $tempDir "$($packageName)Install.$fileType"
  
  Get-ChocolateyWebFile $packageName $file $url $url64bit -checkSum $checkSum -checksumType $checksumType -checkSum64 $checkSum64 -checksumType64 $checksumType64
  Get-ChocolateyUnzip "$file" $unzipLocation $specificFolder $packageName
}
tools\chocolateyInstall\helpers\functions\Set-EnvironmentVariable.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Set-EnvironmentVariable([string] $Name, [string] $Value, [System.EnvironmentVariableTarget] $Scope) {
	Write-Debug "Calling Set-EnvironmentVariable with `$Name = '$Name', `$Value = '$Value', `$Scope = '$Scope'"
    [Environment]::SetEnvironmentVariable($Name, $Value, $Scope)
}
tools\chocolateyInstall\helpers\functions\Start-ChocolateyProcessAsAdmin.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Start-ChocolateyProcessAsAdmin {
param(
  [string] $statements,
  [string] $exeToRun = 'powershell',
  [switch] $minimized,
  [switch] $noSleep,
  $validExitCodes = @(0)
)
  Write-Debug "Running 'Start-ChocolateyProcessAsAdmin' with exeToRun:`'$exeToRun`', statements: `'$statements`' ";

  $wrappedStatements = $statements
  if ($exeToRun -eq 'powershell') {
    $exeToRun = "$($env:windir)\System32\WindowsPowerShell\v1.0\powershell.exe"
    $importChocolateyHelpers = ""
    Get-ChildItem "$helpersPath" -Filter *.psm1 | ForEach-Object { $importChocolateyHelpers = "& import-module -name  `'$($_.FullName)`';$importChocolateyHelpers" };
    $block = @"
      `$noSleep = `$$noSleep
      $importChocolateyHelpers 
      try{
        `$progressPreference="SilentlyContinue"
        $statements 
        if(!`$noSleep){start-sleep 6}
      }
      catch{
        if(!`$noSleep){start-sleep 8}
        throw
      }
"@
    $encoded = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($block))
    $wrappedStatements = "-NoProfile -ExecutionPolicy bypass -EncodedCommand $encoded"
    $dbgMessage = @"
Elevating Permissions and running powershell block:
$block 
This may take a while, depending on the statements.
"@
  }
  else {
    $dbgMessage = @"
Elevating Permissions and running $exeToRun $wrappedStatements. This may take a while, depending on the statements.
"@
  }
  $dbgMessage | Write-Debug

  $psi = new-object System.Diagnostics.ProcessStartInfo
  $psi.RedirectStandardError = $true
  $psi.UseShellExecute = $false
  $psi.FileName = $exeToRun
  if ($wrappedStatements -ne '') {
    $psi.Arguments = "$wrappedStatements"
  }

  if ([Environment]::OSVersion.Version -ge (new-object 'Version' 6,0)){
    $psi.Verb = "runas"
  }

  $psi.WorkingDirectory = get-location

  if ($minimized) {
    $psi.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Minimized
  }

  $s = [System.Diagnostics.Process]::Start($psi)

  $chocTempDir = Join-Path $env:TEMP "chocolatey"
  if (![System.IO.Directory]::Exists($chocTempDir)) { [System.IO.Directory]::CreateDirectory($chocTempDir) | Out-Null }
  $errorFile = Join-Path $chocTempDir "$($s.Id)-error.stream"
  $s.StandardError.ReadToEnd() | Out-File $errorFile
  $s.WaitForExit()
  if ($validExitCodes -notcontains $s.ExitCode) {
    try {
      $innerError = Import-CLIXML $errorFile | ? { $_.GetType() -eq [String] } | Out-String
    }
    catch{
      $innerError = Get-Content $errorFile | Out-String
    }
    $errorMessage = "[ERROR] Running $exeToRun with $statements was not successful. Exit code was `'$($s.ExitCode)`' Error Message: $innerError."
    Remove-Item $errorFile -Force -ErrorAction SilentlyContinue
    throw $errorMessage
  }

  Write-Debug "Finishing 'Start-ChocolateyProcessAsAdmin'"
}
tools\chocolateyInstall\helpers\functions\Test-ProcessAdminRights.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Test-ProcessAdminRights {
<#
.SYNOPSIS
Tests whether the current process is running with administrative rights.

.DESCRIPTION
This function checks whether the current process has administrative rights
by checking if the current user identity is a member of the Administrators group.
It returns $true if the current process is running with administrative rights,
$false otherwise.

On Windows Vista and later, with UAC enabled, the returned value represents the
actual rights available to the process, i.e. if it returns $true, the process is
running elevated.

.OUTPUTS
System.Boolean

#>

  $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent([Security.Principal.TokenAccessLevels]'Query,Duplicate'))
  $isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
  Write-Debug "Test-ProcessAdminRights: returning $isAdmin"
  return $isAdmin
}
tools\chocolateyInstall\helpers\functions\Uninstall-BinFile.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Uninstall-BinFile {
param(
  [string] $name, 
  [string] $path
)
  Write-Debug "Running 'Uninstall-BinFile' for $name with path:`'$path`'";

  $nugetPath = [System.IO.Path]::GetFullPath((Join-Path "$helpersPath" '..\'))
  $nugetExePath = Join-Path "$nugetPath" 'bin'
  $packageBatchFileName = Join-Path $nugetExePath "$name.bat"
  $packageBashFileName = Join-Path $nugetExePath "$name"
  $packageShimFileName = Join-Path $nugetExePath "$name.exe"
  $path = $path.ToLower().Replace($nugetPath.ToLower(), "%DIR%..\").Replace("\\","\")
  $pathBash = $path.Replace("%DIR%..\","`$DIR/../").Replace("\","/")

  Write-Debug "Attempting to remove the batch and bash shortcuts: $packageBatchFileName and $packageBashFileName"

  if (Test-Path $packageBatchFileName) {
    Write-Host "Removing batch file $packageBatchFileName which pointed to `'$path`'."
    Remove-Item $packageBatchFileName
  }
  else {
    Write-Debug "Tried to remove batch file $packageBatchFileName but it was already removed."
  }

  if (Test-Path $packageBashFileName) {
    Write-Host "Removing bash file $packageBashFileName which pointed to `'$path`'."
    Remove-Item $packageBashFileName
  }
  else {
    Write-Debug "Tried to remove bash file $packageBashFileName but it was already removed."
  }

  Write-Debug "Attempting to remove the shim: $packageShimFileName"
  if (Test-Path $packageShimFileName) {
    Write-Host "Removing shim $packageShimFileName which pointed to `'$path`'."
    Remove-Item $packageShimFileName
  }
  else {
    Write-Debug "Tried to remove shim $packageShimFileName but it was already removed."
  }
}

Set-Alias Remove-BinFile Uninstall-BinFile
tools\chocolateyInstall\helpers\functions\Uninstall-ChocolateyPackage.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Uninstall-ChocolateyPackage {
<#
.SYNOPSIS
Uninstalls a package

.DESCRIPTION
This will uninstall a package on your machine.

.PARAMETER PackageName
The name of the package 

.PARAMETER FileType
This is the extension of the file. This should be either exe or msi.

.PARAMETER SilentArgs
Please include the notSilent tag in your chocolatey nuget package if you are not setting up a silent package.

.PARAMETER File
The full path to the native uninstaller to run

.EXAMPLE
Uninstall-ChocolateyPackage '__NAME__' 'EXE_OR_MSI' 'SILENT_ARGS' 'FilePath'

.OUTPUTS
None

.NOTES
This helper reduces the number of lines one would have to write to run an uninstaller to 1 line.
There is no error handling built into this method.

.LINK
Uninstall-ChocolateyPackage
#>
param(
  [string] $packageName, 
  [alias("installerType")][string] $fileType = 'exe',
  [string] $silentArgs = '',
  [string] $file,
  $validExitCodes = @(0)
)
  Write-Debug "Running 'Uninstall-ChocolateyPackage' for $packageName with fileType:`'$fileType`', silentArgs: `'$silentArgs`', file: `'$file`'";
  
  $installMessage = "Uninstalling $packageName..."
  write-host $installMessage

  $additionalInstallArgs = $env:chocolateyInstallArguments;
  if ($additionalInstallArgs -eq $null) { $additionalInstallArgs = ''; }
  $overrideArguments = $env:chocolateyInstallOverride;
    
  if ($fileType -like 'msi') {
    $msiArgs = "/x" 
    if ($overrideArguments) { 
      $msiArgs = "$msiArgs $additionalInstallArgs";
      write-host "Overriding package arguments with `'$additionalInstallArgs`'";
    } else {
      $msiArgs = "$msiArgs $silentArgs $additionalInstallArgs";
    }
    
    Start-ChocolateyProcessAsAdmin "$msiArgs" 'msiexec' -validExitCodes $validExitCodes
    #Start-Process -FilePath msiexec -ArgumentList $msiArgs -Wait
  }
  if ($fileType -like 'exe') {
    if ($overrideArguments) {
      Write-Host "Overriding package arguments with `'$additionalInstallArgs`'";
      Start-ChocolateyProcessAsAdmin "$additionalInstallArgs" $file -validExitCodes $validExitCodes
    } else {
      Start-ChocolateyProcessAsAdmin "$silentArgs $additionalInstallArgs" $file -validExitCodes $validExitCodes
    }
  }

  write-host "$packageName has been uninstalled."
  #cutStart-Sleep 3
}
tools\chocolateyInstall\helpers\functions\UnInstall-ChocolateyZipPackage.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function UnInstall-ChocolateyZipPackage {
<#
.SYNOPSIS
UnInstalls a previous installed zip package

.DESCRIPTION
This will uninstall a zip file if installed via Install-ChocolateyZipPackage

.PARAMETER PackageName
The name of the package the zip file is associated with

.PARAMETER ZipFileName
This is the zip filename originally installed.

.EXAMPLE
UnInstall-ChocolateyZipPackage '__NAME__' 'filename.zip' 

.OUTPUTS
None

.NOTES
This helper reduces the number of lines one would have to remove the files extracted from a previously installed zip file.
This method has error handling built into it.

  
#>
param(
  [string] $packageName, 
  [string] $zipFileName
)
  Write-Debug "Running 'UnInstall-ChocolateyZipPackage' for $packageName $zipFileName "
  
  $packagelibPath=$env:chocolateyPackageFolder
  $zipContentFile=(join-path $packagelibPath $zipFileName) + ".txt"
  if ((Test-Path -path $zipContentFile)) {
    $zipContentFile
    $zipContents=get-content $zipContentFile
    foreach ($fileInZip in $zipContents) {
      remove-item -Path "$fileInZip" -ErrorAction SilentlyContinue -Recurse -Force
    }
  }
}
tools\chocolateyInstall\helpers\functions\Update-SessionEnvironment.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Update-SessionEnvironment {
<#
.SYNOPSIS
Updates the environment variables of the current powershell session with
any environment variable changes that may have occured during a chocolatey
package install.

.DESCRIPTION
When chocolatey installs a package, the package author may add or change
certain environment variables that will affect how the application runs
or how it is accessed. Often, these changes are not visible to the current
powershell session. This means the user needs to open a new powershell
session before these settings take effect which can render the installed
application unfunctional until that time.

Use the Update-SessionEnvironment command to refresh the current
powershell session with all environment settings possibly performed by
chocolatey package installs.

#>

  Write-Debug "Running 'Update-SessionEnvironment' - Updating the environment variables for the session."

  #ordering is important here, $user comes after so we can override $machine
  'Machine', 'User' |
    % {
      $scope = $_
      Get-EnvironmentVariableNames -Scope $scope |
        % {
          Set-Item "Env:$($_)" -Value (Get-EnvironmentVariable -Scope $scope -Name $_)
        }
    }

  #Path gets special treatment b/c it munges the two together
  $paths = 'Machine', 'User' |
    % {
      (Get-EnvironmentVariable -Name 'PATH' -Scope $_) -split ';'
    } |
    Select -Unique
  $Env:PATH = $paths -join ';'
}
tools\chocolateyInstall\helpers\functions\Write-ChocolateyFailure.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Write-ChocolateyFailure {
param(
  [string] $packageName,
  [string] $failureMessage
)
  Write-Warning "Write-ChocolateyFailure is deprecated. If you are the package maintainer, please use 'throw `$_.Exception' instead."
    
  $error | %{ $_.Exception | fl * | Out-String }

  throw "$failureMessage"
}
tools\chocolateyInstall\helpers\functions\Write-ChocolateySuccess.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Write-ChocolateySuccess {
param(
  [string] $packageName
)
  Write-Warning "Write-ChocolateySuccess is deprecated. If you are the maintainer, please remove it from your package file."
}
tools\chocolateyInstall\helpers\functions\Write-FileUpdateLog.ps1
# Copyright 2011 - Present RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

function Write-FileUpdateLog {
  param (
    [string] $logFilePath,
    [string] $locationToMonitor,
    [scriptblock] $scriptToRun,
    [object[]] $argumentList
  )
  Write-Debug "Running 'Write-FileUpdateLog' with logFilePath:`'$logFilePath`'', locationToMonitor:$locationToMonitor, Operation: `'$scriptToRun`'";

  Write-Debug "Tracking current state of `'$locationToMonitor`'"
  $originalContents = Get-ChildItem -Recurse $locationToMonitor | Select-Object LastWriteTimeUTC,FullName,Length

  Invoke-Command -ScriptBlock $scriptToRun -ArgumentList $argumentList

  $newContents = Get-ChildItem -Recurse $locationToMonitor | Select-Object LastWriteTimeUTC,FullName,Length

  if($originalContents -eq $null) {$originalContents = @()}
  if($newContents -eq $null) {$newContents = @()}

  $changedFiles = Compare-Object $originalContents $newContents -Property LastWriteTimeUtc,FullName,Length -PassThru | Group-Object FullName

  #log modified files
  $changedFiles | ? {$_.Count -gt 1} | % {$_.Name} | Add-Content $logFilePath
 
  #log added files
  $addOrDelete = $changedFiles | ? { $_.Count -eq 1 } | % {$_.Group}
  $addOrDelete | ? {$_.SideIndicator -eq "=>"} | % {$_.FullName} | Add-Content $logFilePath

  #log deleted files
  #$addOrDelete | ? {$_.SideIndicator -eq "<="} | % {$_.FullName} | Add-Content $logFilePath
}
tools\chocolateyInstall\LICENSE.txt
   Copyright 2011 - Present RealDimensions Software, LLC

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
tools\chocolateyInstall\redirects\choco.exe
md5: 5E8B1F21584079E900245585ED3F126D | sha1: EA630F6189BE18F00611B8A0A39EC21081824F06 | sha256: 5B7D746BE695B0DED61ABEEC31E85EA07CD3EFEAB2CAFB9A786F8FC57F189C41 | sha512: CD68CD520384D031169C3C31D31F957FDEA913670E9826242A6FC49B65E3147AF66B883999D0AF2F61BD17084B261FAFD36886E10ED348606D1BACE65352877F
tools\chocolateyInstall\redirects\choco.exe.ignore
 
tools\chocolateyInstall\redirects\chocolatey.exe
md5: 5032AA9E2916CFD432A2ACF3CFAE7C68 | sha1: 809A309651AB5879E62620112F3D852652F64190 | sha256: 813ABF87EB71B58873FC2399563A0840191C032EB791B6509FD83C67E981CFA9 | sha512: D2B08E71262D9D4C8C5810E0DB804961092B98B7A5B02B7B736392F562CDD9B81C4674DDCB73770F9F3C6CCADD8AB0C7FB99B2C28E462C86A4FC2978EDA241F9
tools\chocolateyInstall\redirects\chocolatey.exe.ignore
 
tools\chocolateyInstall\redirects\cinst.exe
md5: EE5A4885ACF64550A9138A03DD8C72F6 | sha1: 314DF7BDC96F039F4E2F1FC5DE3D1C84C1452558 | sha256: A934ABD9613740403CCB498D45150F0BBA5B56D71D375BDF8DD7BC962D4EFEFA | sha512: 22330E85384268AA7D73F0D01A8F61799EA9D8A20ECC7921CF631B2DD273A6819B3C4FBBF896A6583776A6DD307862913FFD99D1860E50A52577B793F70FC398
tools\chocolateyInstall\redirects\cinst.exe.ignore
 
tools\chocolateyInstall\redirects\clist.exe
md5: E06E3F081E37533C7915D94C85E117FF | sha1: C3AD89EE21E9D039BA795817B38A7DAC9E7FE830 | sha256: 8054E61031D13760310A217B88F548387F188FD1C0E10DD221114B9B5FED018F | sha512: 91B2F601BD0799587DFA07FC188BDE3DA3D248DEB1E5BB1878FCCD12B67BD7D91469168B2616664EAD38D8B0266A09E05D0931C6559A1209200CEB14966FC62E
tools\chocolateyInstall\redirects\clist.exe.ignore
 
tools\chocolateyInstall\redirects\cpack.exe
md5: 1B011799F987B8C57332FC582833998A | sha1: 250C03D431150BAD04D26C2BB6B1C2DC356EB394 | sha256: E954DF0EBAFF40AD798A0F546100591FB840412E5F680E5E5A981B5B76EAD71E | sha512: 603DAB2ABA2E27513DB39B827258F4075F6C1F8AE0F77A6A399E4676F7E896E34B07BA3CAE582B3CA1AD0CA3AB4305458E7E57364246865DB2894F72FD2D197B
tools\chocolateyInstall\redirects\cpack.exe.ignore
 
tools\chocolateyInstall\redirects\cpush.exe
md5: 6BD3213936F0CDA6CCD17DBF4DEA345E | sha1: D52F928174E5579A13C948D8F64CBB534EB91218 | sha256: 1A524AE602F604DAF580D302A43B8E280C30EC515FDD0736AB1E6F610444A1B8 | sha512: 76E909861A3942F2D3CD02D4ACDE13AA284F279327E807D01541BC790FA21CC4241E3011AC9C6F0D93DC104DB9121FF8FF497E8EA41C05669DB4A4931EADB6FA
tools\chocolateyInstall\redirects\cpush.exe.ignore
 
tools\chocolateyInstall\redirects\cuninst.exe
md5: 9F47F8A73159BAEC52169FEB2EA169FC | sha1: 8425326C9A9A5E1705A6FEBC215A3A56D7FF4E64 | sha256: 66E7EF5EE18E20C37905EAD289836D17232B17C5902388719D61F50A4AB98A4E | sha512: 75E87BB20A2FBC5E7B62F1D485EE4C5CDE5C8945CE2B445F7856E532A4FE01E71174822BDB38D7ABB2CC21817D4FA973B5EE7AFF22CDEA7391CA10727D315301
tools\chocolateyInstall\redirects\cuninst.exe.ignore
 
tools\chocolateyInstall\redirects\cup.exe
md5: 7652FCD7C0CBC556743D008A041F3513 | sha1: DC5D613D61144C776E81987F6276E5BD09B73D86 | sha256: 0001FAE6C0E80C3A9C1CAA18F513AA34F2EB5423EABADF90D85C5708FE1615DD | sha512: 15ECDE398D4ED7707963CE91CD824CC9F239AB45F9F875F5EAEB27823BDBCA5E56EE0A8F4911B50C8AC6FA34762CD97DF63C213AADAABA920CA67BDCD2287CFF
tools\chocolateyInstall\redirects\cup.exe.ignore
 
tools\chocolateyInstall\redirects\cver.exe
md5: A4859D16E178CE253AEFB73C2EE55A64 | sha1: BF638672DCF21F5C260D457CC12D04473E0ABFDB | sha256: 71150D734CFF89D993F13ABB084A50AF08FE98867E4C35856CCFF36DCA0BA217 | sha512: A3F006E296A85191C766404E85A3D039B05ED3BCFDFBAFB10991EBAFD1F19A80521A4D685D506A861C1325EB2B0A1166916ABFB2799AB8EE004B6DCDE254EE94
tools\chocolateyInstall\redirects\cver.exe.ignore
 
tools\chocolateyInstall\redirects\RefreshEnv.cmd
@echo off
::
:: RefreshEnv.cmd
::
:: Batch file to read environment variables from registry and
:: set session variables to these values.
::
:: With this batch file, there should be no need to reload command
:: environment every time you want environment changes to propagate

echo | set /p dummy="Reading environment variables from registry. Please wait... "

goto main

:: Set one environment variable from registry key
:SetFromReg
    "%WinDir%\System32\Reg" QUERY "%~1" /v "%~2" > "%TEMP%\_envset.tmp" 2>NUL
    for /f "usebackq skip=2 tokens=2,*" %%A IN ("%TEMP%\_envset.tmp") do (
        echo/set %~3=%%B
    )
    goto :EOF

:: Get a list of environment variables from registry
:GetRegEnv
    "%WinDir%\System32\Reg" QUERY "%~1" > "%TEMP%\_envget.tmp"
    for /f "usebackq skip=2" %%A IN ("%TEMP%\_envget.tmp") do (
        if /I not "%%~A"=="Path" (
            call :SetFromReg "%~1" "%%~A" "%%~A"
        )
    )
    goto :EOF

:main
    echo/@echo off >"%TEMP%\_env.cmd"

    :: Slowly generating final file
    call :GetRegEnv "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" >> "%TEMP%\_env.cmd"
    call :GetRegEnv "HKCU\Environment">>"%TEMP%\_env.cmd" >> "%TEMP%\_env.cmd"

    :: Special handling for PATH - mix both User and System
    call :SetFromReg "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" Path Path_HKLM >> "%TEMP%\_env.cmd"
    call :SetFromReg "HKCU\Environment" Path Path_HKCU >> "%TEMP%\_env.cmd"

    :: Caution: do not insert space-chars before >> redirection sign
    echo/set Path=%%Path_HKLM%%;%%Path_HKCU%% >> "%TEMP%\_env.cmd"

    :: Cleanup
    del /f /q "%TEMP%\_envset.tmp" 2>nul
    del /f /q "%TEMP%\_envget.tmp" 2>nul

    :: Set these variables
    call "%TEMP%\_env.cmd"

    echo | set /p dummy="Done"
    echo .
tools\chocolateyInstall\tools\7za.exe
md5: 42BADC1D2F03A8B1E4875740D3D49336 | sha1: CEE178DA1FB05F99AF7A3547093122893BD1EB46 | sha256: C136B1467D669A725478A6110EBAAAB3CB88A3D389DFA688E06173C066B76FCF | sha512: 6BC519A7368EE6BD8C8F69F2D634DD18799B4CA31FBC284D2580BA625F3A88B6A52D2BC17BEA0E75E63CA11C10356C47EE00C2C500294ABCB5141424FC5DC71C
tools\chocolateyInstall\tools\7za.exe.ignore
 
tools\chocolateyInstall\tools\7za.exe.manifest
 
tools\chocolateyInstall\tools\7zip.license.txt
      7-Zip Extra
      ~~~~~~~~~~~
      License for use and distribution
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      Copyright (C) 1999-2015 Igor Pavlov.

      7-Zip Extra files are under the GNU LGPL license.

      
      Notes: 
        You can use 7-Zip Extra on any computer, including a computer in a commercial 
        organization. You don't need to register or pay for 7-Zip.


      GNU LGPL information
      --------------------

        This library is free software; you can redistribute it and/or
        modify it under the terms of the GNU Lesser General Public
        License as published by the Free Software Foundation; either
        version 2.1 of the License, or (at your option) any later version.

        This library is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
        Lesser General Public License for more details.

        You can receive a copy of the GNU Lesser General Public License from 
        http://www.gnu.org/
tools\chocolateyInstall\tools\checksum.exe
md5: 0AA5F736E619FDB8664C43779466DD14 | sha1: FE239546417500BA0B324E2C6F205865DE0DE7D8 | sha256: 69B22EE0C328DDE3D291E03170FAAB8A5C663685111CC4D201AB786994CE3EA5 | sha512: 5ECC9148243492BC7966403DD4433199A734996EB2F7C07781671EAAA726E4D6987231E4678D2DAA147875FFE13B3516B91A0778E2D218AF2C71BD3EC7F0A1A2
tools\chocolateyInstall\tools\checksum.exe.ignore
 
tools\chocolateyInstall\tools\checksum.license.txt
CheckSum is licensed as Apache v2 - https://raw.github.com/ferventcoder/checksum/master/LICENSE
tools\chocolateyInstall\tools\shimgen.exe
md5: EEF0CB5CB3887B8B50A0FDAF5DA57572 | sha1: 2235CC0AD8DDC5196F908E04722995FABB6AFB9D | sha256: F4A1DCE9F4945DC4914AD9F8F93F2B667C200D9026392E3FA77E4110E0308047 | sha512: 297395E7FE128B89E13FFD6BFAD521CE553FA0A8DF8EEFBA06941E01172B393889E54CF2B1B4358E3357EFB78C237A2F83CD98CE5DFE2E06AC2C6BB90F507BF5
tools\chocolateyInstall\tools\shimgen.exe.ignore
 
tools\chocolateyInstall\tools\shimgen.license.txt
Shim Generator - shimgen.exe
Copyright (C) 2013-Present RealDimensions Software, LLC ("RDS")
===================================================================
Grant of License
===================================================================
You may use Shim Generator ("shimgen.exe") only with the official chocolatey client.

The use of shimgen.exe for any other reason is strictly prohibited.

If you would like to use this software for any other reason, you must obtain a personal or commercial license to do so. To do that you must contact RDS at ferventcoder.com.

This software is not free to distribute.  If you would like to distribute this software, you must receive written permission from the software owner.

===================================================================
End-User License Agreement
===================================================================
EULA - Shim Generator

IMPORTANT- READ CAREFULLY: This RealDimensions Software ("RDS") End-User License Agreement ("EULA") is a legal agreement between you("End User") and RDS for all RDS products, controls, source code, demos, intermediate files, media, printed materials, and "online" or electronic documentation ("SOFTWARE PRODUCT(S)") contained with this distribution.

RDS grants to you as an individual, a personal, nonexclusive license to install and use the SOFTWARE PRODUCT(S) for the sole purpose of use with the official chocolatey client. By installing, copying, or otherwise using the SOFTWARE PRODUCT(S), you agree to be bound by the terms of this EULA. If you do not agree to any part of the terms of this EULA, DO NOT INSTALL, USE, OR EVALUATE, ANY PART, FILE OR PORTION OF THE SOFTWARE PRODUCT(S).

ALL SOFTWARE PRODUCT(S) are licensed not sold. If you are an individual, you must acquire an individual license for the SOFTWARE PRODUCT(S) from RDS or its authorized resellers. If you are an entity, you must acquire an individual license for each Developer End User and each Build Machine Running the SOFTWARE PRODUCT(S) within your organization from RDS or its authorized resellers. Both Virtual and Physical Build Machines running the SOFTWARE PRODUCT(S) must be counted in the SOFTWARE PRODUCT(S) licenses quantity of the organization.

===================================================================
Commercial / Personal Licensing
===================================================================
Shim Generator (shimgen.exe) is also offered under personal and commercial licenses.
You can learn more about this option by contacting RDS at http://ferventcoder.com
tools\chocolateysetup.psm1
$thisScriptFolder = (Split-Path -parent $MyInvocation.MyCommand.Definition)
$chocInstallVariableName = "ChocolateyInstall"
$sysDrive = $env:SystemDrive
$tempDir = $env:TEMP
$defaultChocolateyPathOld = "$sysDrive\Chocolatey"

function Initialize-Chocolatey {
<#
  .DESCRIPTION
    This will initialize the Chocolatey tool by
      a) setting up the "chocolateyPath" (the location where all chocolatey nuget packages will be installed)
      b) Installs chocolatey into the "chocolateyPath"
            c) Instals .net 4.0 if needed
      d) Adds Chocolatey to the PATH environment variable so you have access to the choco commands.
  .PARAMETER  ChocolateyPath
    Allows you to override the default path of (C:\ProgramData\chocolatey\) by specifying a directory chocolatey will install nuget packages.

  .EXAMPLE
    C:\PS> Initialize-Chocolatey

    Installs chocolatey into the default C:\ProgramData\Chocolatey\ directory.

  .EXAMPLE
    C:\PS> Initialize-Chocolatey -chocolateyPath "D:\ChocolateyInstalledNuGets\"

    Installs chocolatey into the custom directory D:\ChocolateyInstalledNuGets\

#>
param(
  [Parameter(Mandatory=$false)][string]$chocolateyPath = ''
)
  Write-Debug "Initialize-Chocolatey"

  $installModule = Join-Path $thisScriptFolder 'chocolateyInstall\helpers\chocolateyInstaller.psm1'
  Import-Module $installModule -Force

  if ($chocolateyPath -eq '') {
    $programData = [Environment]::GetFolderPath("CommonApplicationData")
    $chocolateyPath = Join-Path "$programData" 'chocolatey'
  }

  # variable to allow insecure directory:
  $allowInsecureRootInstall = $false
  if ($env:ChocolateyAllowInsecureRootDirectory -eq 'true') { $allowInsecureRootInstall = $true }

  # if we have an already environment variable path, use it.
  $alreadyInitializedNugetPath = Get-ChocolateyInstallFolder
  if ($alreadyInitializedNugetPath -and $alreadyInitializedNugetPath -ne $chocolateyPath -and ($allowInsecureRootInstall -or $alreadyInitializedNugetPath -ne $defaultChocolateyPathOld)){
    $chocolateyPath = $alreadyInitializedNugetPath
  }
  else {
    Set-ChocolateyInstallFolder $chocolateyPath
  }
  Create-DirectoryIfNotExists $chocolateyPath

  Ensure-UserPermissions $chocolateyPath

  #set up variables to add
  $chocolateyExePath = Join-Path $chocolateyPath 'bin'
  $chocolateyLibPath = Join-Path $chocolateyPath 'lib'

  if ($tempDir -eq $null) {
    $tempDir = Join-Path $chocolateyPath 'temp'
    Create-DirectoryIfNotExists $tempDir
  }

  $yourPkgPath = [System.IO.Path]::Combine($chocolateyLibPath,"yourPackageName")
@"
We are setting up the Chocolatey package repository.
The packages themselves go to `'$chocolateyLibPath`'
  (i.e. $yourPkgPath).
A shim file for the command line goes to `'$chocolateyExePath`'
  and points to an executable in `'$yourPkgPath`'.

Creating Chocolatey folders if they do not already exist.

"@ | Write-Output

  Write-Warning "You can safely ignore errors related to missing log files when `n  upgrading from a version of Chocolatey less than 0.9.9. `n  'Batch file could not be found' is also safe to ignore. `n  'The system cannot find the file specified' - also safe."

  #create the base structure if it doesn't exist
  Create-DirectoryIfNotExists $chocolateyExePath
  Create-DirectoryIfNotExists $chocolateyLibPath

  Install-ChocolateyFiles $chocolateyPath
  Ensure-ChocolateyLibFiles $chocolateyLibPath

  Install-ChocolateyBinFiles $chocolateyPath $chocolateyExePath

  $chocolateyExePathVariable = $chocolateyExePath.ToLower().Replace($chocolateyPath.ToLower(), "%DIR%..\").Replace("\\","\")
  Initialize-ChocolateyPath $chocolateyExePath $chocolateyExePathVariable
  Process-ChocolateyBinFiles $chocolateyExePath $chocolateyExePathVariable

  $realModule = Join-Path $chocolateyPath "helpers\chocolateyInstaller.psm1"
  Import-Module "$realModule" -Force

  if (-not $allowInsecureRootInstall -and (Test-Path($defaultChocolateyPathOld))) {
    Upgrade-OldChocolateyInstall $defaultChocolateyPathOld $chocolateyPath
    Install-ChocolateyBinFiles $chocolateyPath $chocolateyExePath
  }

  Install-DotNet4IfMissing

@"
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
"@ | write-Output

  if (-not $allowInsecureRootInstall) {
    Remove-OldChocolateyInstall $defaultChocolateyPathOld
  }
}

function Set-ChocolateyInstallFolder {
param(
  [string]$folder
)
  Write-Debug "Set-ChocolateyInstallFolder"

  $environmentTarget = [System.EnvironmentVariableTarget]::User
  # removing old variable
  Install-ChocolateyEnvironmentVariable -variableName "$chocInstallVariableName" -variableValue $null -variableType $environmentTarget
  if (Test-ProcessAdminRights) {
    Write-Debug "Administrator installing so using Machine environment variable target instead of User."
    $environmentTarget = [System.EnvironmentVariableTarget]::Machine
    # removing old variable
    Install-ChocolateyEnvironmentVariable -variableName "$chocInstallVariableName" -variableValue $null -variableType $environmentTarget
  } else {
    Write-Warning "Setting ChocolateyInstall Environment Variable on USER and not SYSTEM variables.`n  This is due to either non-administrator install OR the process you are running is not being run as an Administrator."
  }

  Write-Output "Creating $chocInstallVariableName as an environment variable (targeting `'$environmentTarget`') `n  Setting $chocInstallVariableName to `'$folder`'"
  Write-Warning "It's very likely you will need to close and reopen your shell `n  before you can use choco."
  Install-ChocolateyEnvironmentVariable -variableName "$chocInstallVariableName" -variableValue "$folder" -variableType $environmentTarget
}

function Get-ChocolateyInstallFolder(){
  Write-Debug "Get-ChocolateyInstallFolder"
  [Environment]::GetEnvironmentVariable($chocInstallVariableName)
}

function Create-DirectoryIfNotExists($folderName){
  Write-Debug "Create-DirectoryIfNotExists"
  if (![System.IO.Directory]::Exists($folderName)) { [System.IO.Directory]::CreateDirectory($folderName) | Out-Null }
}

function Ensure-UserPermissions {
param(
  [string]$folder
)
  Write-Debug "Ensure-UserPermissions"

  if (!(Test-ProcessAdminRights)) {
    Write-Warning "User is not running elevated, cannot set user permissions."
    return
  }

  $currentEA = $ErrorActionPreference
  $ErrorActionPreference = 'Stop'
  try {
    # get current user
    $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
    # get current acl
    $acl = Get-Acl $folder

    # define rule to set
    $rights = "Modify"
    $userAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($currentUser.Name, $rights, "Allow")

    # this is idempotent
    Write-Output "Adding Modify permission for current user to '$folder'"
    $acl.SetAccessRuleProtection($false,$true)
    $acl.SetAccessRule($userAccessRule)
    Set-Acl $folder $acl
  } catch {
    Write-Warning "Not able to set permissions for user."
  }
  $ErrorActionPreference = $currentEA
}

function Upgrade-OldChocolateyInstall {
param(
  [string]$chocolateyPathOld = "$sysDrive\Chocolatey",
  [string]$chocolateyPath =  "$($env:ALLUSERSPROFILE)\chocolatey"
)

  Write-Debug "Upgrade-OldChocolateyInstall"

  if (Test-Path $chocolateyPathOld) {
    Write-Output "Attempting to upgrade `'$chocolateyPathOld`' to `'$chocolateyPath`'."
    Write-Warning "Copying the contents of `'$chocolateyPathOld`' to `'$chocolateyPath`'. `n This step may fail if you have anything in this folder running or locked."
    Write-Output 'If it fails, just manually copy the rest of the items out and then delete the folder.'
    Write-Warning "!!!! ATTN: YOU WILL NEED TO CLOSE AND REOPEN YOUR SHELL !!!!"
    #-ForegroundColor Magenta -BackgroundColor Black

    $chocolateyExePathOld = Join-Path $chocolateyPathOld 'bin'
    'Machine', 'User' |
    % {
      $path = Get-EnvironmentVariable -Name 'PATH' -Scope $_
      $updatedPath = [System.Text.RegularExpressions.Regex]::Replace($path,[System.Text.RegularExpressions.Regex]::Escape($chocolateyExePathOld) + '(?>;)?', '', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
      if ($updatedPath -ne $path) {
        Write-Output "Updating `'$_`' PATH to reflect removal of '$chocolateyPathOld'."
        try {
          Set-EnvironmentVariable -Name 'Path' -Value $updatedPath -Scope $_ -ErrorAction Stop
        } catch {
          Write-Warning "Was not able to remove the old environment variable from PATH. You will need to do this manually"
        }

      }
    }

    Copy-Item "$chocolateyPathOld\lib\*" "$chocolateyPath\lib" -force -recurse

    $from = "$chocolateyPathOld\bin"
    $to = "$chocolateyPath\bin"
    $exclude = @("choco.exe", "chocolatey.exe", "cinst.exe", "clist.exe", "cpack.exe", "cpush.exe", "cuninst.exe", "cup.exe", "cver.exe", "RefreshEnv.cmd")
    Get-ChildItem -Path $from -recurse -Exclude $exclude |
      % {
        Write-Debug "Copying $_ `n to $to"
        if ($_.PSIsContainer) {
          Copy-Item $_ -Destination (Join-Path $to $_.Parent.FullName.Substring($from.length)) -Force -ErrorAction SilentlyContinue
        } else {
          $fileToMove = (Join-Path $to $_.FullName.Substring($from.length))
          try {
           Copy-Item $_ -Destination $fileToMove -Exclude $exclude -Force -ErrorAction Stop
          }
          catch {
            Write-Warning "Was not able to move `'$fileToMove`'. You may need to reinstall the shim"
          }
        }
      }
  }
}

function Remove-OldChocolateyInstall {
param(
  [string]$chocolateyPathOld = "$sysDrive\Chocolatey"
)
  Write-Debug "Remove-OldChocolateyInstall"

  if (Test-Path $chocolateyPathOld) {
    Write-Warning "This action will result in Log Errors, you can safely ignore those. `n You may need to finish removing '$chocolateyPathOld' manually."
    try {
      Get-ChildItem -Path "$chocolateyPathOld" | % {
        if (Test-Path $_.FullName) {
          Write-Debug "Removing $_ unless matches .log"
          Remove-Item $_.FullName -exclude *.log -recurse -force -ErrorAction SilentlyContinue
        }
      }

      Write-Output "Attempting to remove `'$chocolateyPathOld`'. This may fail if something in the folder is being used or locked."
      Remove-Item "$($chocolateyPathOld)" -force -recurse -ErrorAction Stop
    }
    catch {
      Write-Warning "Was not able to remove `'$chocolateyPathOld`'. You will need to manually remove it."
    }
  }
}

function Install-ChocolateyFiles {
param(
  [string]$chocolateyPath
)
  Write-Debug "Install-ChocolateyFiles"

  Write-Debug "Removing install files in chocolateyInstall, helpers, redirects, and tools"
  "$chocolateyPath\chocolateyInstall", "$chocolateyPath\helpers", "$chocolateyPath\redirects", "$chocolateyPath\tools" | % {
    #Write-Debug "Checking path $_"

    if (Test-Path $_) {
      Get-ChildItem -Path "$_" | % {
        #Write-Debug "Checking child path $_ ($($_.FullName))"
        if (Test-Path $_.FullName) {
          Write-Debug "Removing $_ unless matches .log"
          Remove-Item $_.FullName -exclude *.log -recurse -force -ErrorAction SilentlyContinue
        }
      }
    }
  }

  Write-Debug "Attempting to move choco.exe to choco.exe.old so we can place the new version here."
  # rename the currently running process / it will be locked if it exists
  $chocoExe = Join-Path $chocolateyPath 'choco.exe'
  if (Test-Path ($chocoExe)) {
    Write-Debug "Renaming '$chocoExe' to '$chocoExe.old'"
    try {
      Remove-Item "$chocoExe.old" -force -ErrorAction SilentlyContinue
      Move-Item $chocoExe "$chocoExe.old" -force -ErrorAction SilentlyContinue
    }
    catch {
      Write-Warning "Was not able to rename `'$chocoExe`' to `'$chocoExe.old`'."
    }
  }

  Write-Debug "Unpacking files required for Chocolatey."
  $chocInstallFolder = Join-Path $thisScriptFolder "chocolateyInstall"
  $chocoExe = Join-Path $chocInstallFolder 'choco.exe'
  $chocoExeDest = Join-Path $chocolateyPath 'choco.exe'
  Copy-Item $chocoExe $chocoExeDest -force

  Write-Debug "Copying the contents of `'$chocInstallFolder`' to `'$chocolateyPath`'."
  Copy-Item $chocInstallFolder\* $chocolateyPath -recurse -force
}

function Ensure-ChocolateyLibFiles {
param(
  [string]$chocolateyLibPath
)
  Write-Debug "Ensure-ChocolateyLibFiles"
  $chocoPkgDirectory = Join-Path $chocolateyLibPath 'chocolatey'

  Create-DirectoryIfNotExists $chocoPkgDirectory

  if (!(Test-Path("$chocoPkgDirectory\chocolatey.nupkg"))) {
    Write-Output "chocolatey.nupkg file not installed in lib.`n Attempting to locate it from bootstrapper."
    $chocoZipFile = Join-Path $tempDir "chocolatey\chocInstall\chocolatey.zip"

    Write-Debug "First the zip file at '$chocoZipFile'."
    Write-Debug "Then from a neighboring chocolatey.*nupkg file '$thisScriptFolder/../../'."

    if (Test-Path("$chocoZipFile")) {
      Write-Debug "Copying '$chocoZipFile' to '$chocoPkgDirectory\chocolatey.nupkg'."
      Copy-Item "$chocoZipFile" "$chocoPkgDirectory\chocolatey.nupkg" -Force -ErrorAction SilentlyContinue
    }

    if (!(Test-Path("$chocoPkgDirectory\chocolatey.nupkg"))) {
      $chocoPkg = Get-ChildItem "$thisScriptFolder/../../" | ?{$_.name -match "^chocolatey.*nupkg" } | Sort name -Descending | Select -First 1
      if ($chocoPkg -ne '') { $chocoPkg = $chocoPkg.FullName }
      "$chocoZipFile", "$chocoPkg" | % {
        if ($_ -ne $null -and $_ -ne '') {
          if (Test-Path $_) {
            Write-Debug "Copying '$_' to '$chocoPkgDirectory\chocolatey.nupkg'."
            Copy-Item $_ "$chocoPkgDirectory\chocolatey.nupkg" -Force -ErrorAction SilentlyContinue
          }
        }
      }
    }
  }
}

function Install-ChocolateyBinFiles {
param(
  [string] $chocolateyPath,
  [string] $chocolateyExePath
)
  Write-Debug "Install-ChocolateyBinFiles"
  Write-Debug "Installing the bin file redirects"
  $redirectsPath = Join-Path $chocolateyPath 'redirects'
  if (!(Test-Path "$redirectsPath")) {
    Write-Warning "$redirectsPath does not exist"
    return
  }

  $exeFiles = Get-ChildItem "$redirectsPath" -include @("*.exe","*.cmd") -recurse
  foreach ($exeFile in $exeFiles) {
    $exeFilePath = $exeFile.FullName
    $exeFileName = [System.IO.Path]::GetFileName("$exeFilePath")
    $binFilePath = Join-Path $chocolateyExePath $exeFileName
    $binFilePathRename = $binFilePath + '.old'
    $batchFilePath = $binFilePath.Replace(".exe",".bat")
    $bashFilePath = $binFilePath.Replace(".exe","")
    if (Test-Path ($batchFilePath)) { Remove-Item $batchFilePath -force -ErrorAction SilentlyContinue }
    if (Test-Path ($bashFilePath)) { Remove-Item $bashFilePath -force -ErrorAction SilentlyContinue }
    if (Test-Path ($binFilePathRename)) {
      try {
        Write-Debug "Attempting to remove $binFilePathRename"
        Remove-Item $binFilePathRename -force -ErrorAction Stop
      }
      catch {
        Write-Warning "Was not able to remove `'$binFilePathRename`'. This may cause errors."
      }
    }
    if (Test-Path ($binFilePath)) {
     try {
        Write-Debug "Attempting to rename $binFilePath to $binFilePathRename"
        Move-Item -path $binFilePath -destination $binFilePathRename -force -ErrorAction Stop
      }
      catch {
        Write-Warning "Was not able to rename `'$binFilePath`' to `'$binFilePathRename`'."
      }
    }

    try {
      Write-Debug "Attempting to copy $exeFilePath to $binFilePath"
      Copy-Item -path $exeFilePath -destination $binFilePath -force -ErrorAction Stop
    }
    catch {
      Write-Warning "Was not able to replace `'$binFilePath`' with `'$exeFilePath`'. You may need to do this manually."
    }

    $commandShortcut = [System.IO.Path]::GetFileNameWithoutExtension("$exeFilePath")
    Write-Debug "Added command $commandShortcut"
  }
}

function Initialize-ChocolateyPath {
param(
  [string]$chocolateyExePath = "$($env:ALLUSERSPROFILE)\chocolatey\bin",
  [string]$chocolateyExePathVariable = "%$($chocInstallVariableName)%\bin"
)
  Write-Debug "Initialize-ChocolateyPath"
  Write-Debug "Initializing Chocolatey Path if required"
  $environmentTarget = [System.EnvironmentVariableTarget]::User
  if (Test-ProcessAdminRights) {
    Write-Debug "Administrator installing so using Machine environment variable target instead of User."
    $environmentTarget = [System.EnvironmentVariableTarget]::Machine
  } else {
    Write-Warning "Setting ChocolateyInstall Path on USER PATH and not SYSTEM Path.`n  This is due to either non-administrator install OR the process you are running is not being run as an Administrator."
  }

  Install-ChocolateyPath -pathToInstall "$chocolateyExePath" -pathType $environmentTarget
}

function Process-ChocolateyBinFiles {
param(
  [string]$chocolateyExePath = "$($env:ALLUSERSPROFILE)\chocolatey\bin",
  [string]$chocolateyExePathVariable = "%$($chocInstallVariableName)%\bin"
)
  Write-Debug "Process-ChocolateyBinFiles"
  $processedMarkerFile = Join-Path $chocolateyExePath '_processed.txt'
  if (!(test-path $processedMarkerFile)) {
    $files = get-childitem $chocolateyExePath -include *.bat -recurse
    if ($files -ne $null -and $files.Count -gt 0) {
      Write-Debug "Processing Bin files"
      foreach ($file in $files) {
        Write-Output "Processing $($file.Name) to make it portable"
        $fileStream = [System.IO.File]::Open("$file", 'Open', 'Read', 'ReadWrite')
        $reader = New-Object System.IO.StreamReader($fileStream)
        $fileText = $reader.ReadToEnd()
        $reader.Close()
        $fileStream.Close()

        $fileText = $fileText.ToLower().Replace("`"" + $chocolateyPath.ToLower(), "SET DIR=%~dp0%`n""%DIR%..\").Replace("\\","\")

        Set-Content $file -Value $fileText -Encoding Ascii
      }
    }

    Set-Content $processedMarkerFile -Value "$([System.DateTime]::Now.Date)" -Encoding Ascii
  }
}

$netFx4InstallTries = 0

function Install-DotNet4IfMissing {
param(
  $forceFxInstall = $false
)
  # we can't take advantage of any chocolatey module functions, because they
  # haven't been unpacked because they require .NET Framework 4.0

  Write-Debug "Install-DotNet4IfMissing"
  if ([IntPtr]::Size -eq 8) {$fx="framework64"} else {$fx="framework"}

  $NetFx4ClientUrl = 'http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe'
  $NetFx4FullUrl = 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe'
  $NetFx4Url = $NetFx4FullUrl
  $NetFx4Path = "$tempDir"
  $NetFx4InstallerFile = 'dotNetFx40_Full_x86_x64.exe'
  $NetFx4Installer = Join-Path $NetFx4Path $NetFx4InstallerFile

  if(!(test-path "$env:windir\Microsoft.Net\$fx\v4.0.30319") -or $forceFxInstall) {
    if (!(Test-Path $NetFx4Path)) {
      Write-Output "Creating folder `'$NetFx4Path`'"
      $null = New-Item -Path "$NetFx4Path" -ItemType Directory
    }

    $netFx4InstallTries += 1

    if (!(Test-Path $NetFx4Installer)) {
      Write-Output "Downloading `'$NetFx4Url`' to `'$NetFx4Installer`' - the installer is 40+ MBs, so this could take awhile on a slow connection."
      (New-Object Net.WebClient).DownloadFile("$NetFx4Url","$NetFx4Installer")
    }

    $psi = New-Object System.Diagnostics.ProcessStartInfo
    $psi.WorkingDirectory = "$NetFx4Path"
    $psi.FileName = "$NetFx4InstallerFile"
    # https://msdn.microsoft.com/library/ee942965(v=VS.100).aspx#command_line_options
    # http://blogs.msdn.com/b/astebner/archive/2010/05/12/10011664.aspx
    # For the actual setup.exe (if you want to unpack first) - /repair /x86 /x64 /ia64 /parameterfolder Client /q /norestart
    $psi.Arguments = "/q /norestart /repair"

    Write-Output "Installing `'$NetFx4Installer`' - this may take awhile with no output."
    $s = [System.Diagnostics.Process]::Start($psi);
    $s.WaitForExit();
    if ($s.ExitCode -ne 0 -and $s.ExitCode -ne 3010) {
      if ($netFx4InstallTries -eq 2) {
        Write-Error ".NET Framework install failed with exit code `'$($s.ExitCode)`'. `n This will cause the rest of the install to fail."
        throw "Error installing .NET Framework 4.0 (exit code $($s.ExitCode)). `n Please install the .NET Framework 4.0 manually and then try to install Chocolatey again. `n Download at `'$NetFx4Url`'"
      } else {
        Write-Warning "First try of .NET framework install failed with exit code `'$($s.ExitCode)`'. Trying again."
        Install-DotNet4IfMissing $true
      }
    }
  }
}

Export-ModuleMember -function Initialize-Chocolatey;
tools\init.ps1
param($installPath, $toolsPath, $package, $project)

$modules = Get-ChildItem $ToolsPath -Filter *.psm1
$modules | ForEach-Object { import-module -name  $_.FullName }

@"
========================
Chocolatey
========================
Welcome to Chocolatey, your local machine repository built on the NuGet infrastructure. Chocolatey allows you to install application packages to your machine with the goodness of a #chocolatey #nuget combo. 
Application executables get added to the path automatically so you can call them from anywhere (command line/powershell prompt), not just in Visual Studio.

Lets get Chocolatey!
----------
Visual Studio -
----------
Please run Initialize-Chocolatey one time per machine to set up the repository. 
If you are upgrading, please remember to run Initialize-Chocolatey again.
After you have run Initiliaze-Chocolatey, you can safely uninstall the chocolatey package from your current Visual Studio solution.
----------
Alternative NuGet -
----------
If you are not using NuGet in Visual Studio, please navigate to the directory with the chocolateysetup.psm1 and run that in Powershell, followed by Initialize-Chocolatey.
Upgrade is the same, just run Initialize-Chocolatey again.
----------
Once you've run initialize or upgrade, you can uninstall this package from the local project without affecting your chocolatey repository.
========================
"@ | Write-Host

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Version Downloads Last Updated Status
Chocolatey 2.2.0 3346675 Wednesday, July 26, 2023 Exempted
Chocolatey 2.1.0 6327811 Thursday, June 29, 2023 Exempted
Chocolatey 2.1.0-alpha-20230614 2142 Wednesday, June 14, 2023 Exempted
Chocolatey 2.1.0-alpha-20230608 940 Thursday, June 8, 2023 Exempted
Chocolatey 2.0.0 9604848 Wednesday, May 31, 2023 Exempted
Chocolatey 2.0.0-beta-20230426 4061 Wednesday, April 26, 2023 Exempted
Chocolatey 2.0.0-beta-20230412 1703 Wednesday, April 12, 2023 Exempted
Chocolatey 2.0.0-beta-20230321 2009 Tuesday, March 21, 2023 Exempted
Chocolatey 2.0.0-alpha-20230307 1300 Tuesday, March 7, 2023 Exempted
Chocolatey 2.0.0-alpha-20230221 1114 Tuesday, February 21, 2023 Exempted
Chocolatey 2.0.0-alpha-20230124 1144 Tuesday, January 24, 2023 Exempted
Chocolatey 1.4.0 2744998 Wednesday, May 10, 2023 Exempted
Chocolatey 1.3.1 5214023 Tuesday, March 14, 2023 Exempted
Chocolatey 1.3.0 3246064 Wednesday, February 15, 2023 Exempted
Chocolatey 1.2.1 6478007 Tuesday, December 6, 2022 Approved
Chocolatey 1.2.0 1717074 Wednesday, October 19, 2022 Approved
Chocolatey 1.1.0 8365792 Wednesday, March 30, 2022 Exempted
Chocolatey 1.0.1 1055545 Thursday, March 24, 2022 Exempted
Chocolatey 1.0.0 872554 Monday, March 21, 2022 Exempted
Chocolatey 0.12.1 4190962 Tuesday, January 25, 2022 Exempted
Chocolatey 0.12.0 1089033 Tuesday, January 18, 2022 Exempted
Chocolatey 0.11.3 5642471 Wednesday, October 27, 2021 Exempted
Chocolatey 0.11.2 6979379 Thursday, September 23, 2021 Exempted
Chocolatey 0.11.1 3907939 Thursday, September 2, 2021 Exempted
Chocolatey 0.10.16-beta-20200806 15031 Thursday, August 6, 2020 Approved
Chocolatey 0.10.15 71250310 Monday, June 3, 2019 Approved
Chocolatey 0.10.15-beta-20190531 1160 Friday, May 31, 2019 Approved
Chocolatey 0.10.14 510464 Thursday, May 30, 2019 Approved
Chocolatey 0.10.14-beta-20190418 5570 Thursday, April 18, 2019 Approved
Chocolatey 0.10.14-beta-20190402 2992 Tuesday, April 2, 2019 Approved
Chocolatey 0.10.14-beta-20190321 2501 Friday, March 22, 2019 Approved
Chocolatey 0.10.13 7772519 Friday, March 15, 2019 Approved
Chocolatey 0.10.12 152452 Friday, March 15, 2019 Approved
Chocolatey 0.10.12-beta-20181011 15330 Friday, October 12, 2018 Approved
Chocolatey 0.10.12-beta-20181009 869 Tuesday, October 9, 2018 Approved
Chocolatey 0.10.11 29152746 Friday, May 4, 2018 Approved
Chocolatey 0.10.10 2954368 Thursday, April 12, 2018 Approved
Chocolatey 0.10.9 5426933 Sunday, March 25, 2018 Approved
Chocolatey 0.10.9-beta-20180223 3722 Friday, February 23, 2018 Approved
Chocolatey 0.10.8 24666752 Wednesday, August 30, 2017 Approved
Chocolatey 0.10.8-beta-20170806 5217 Monday, August 7, 2017 Approved
Chocolatey 0.10.7 18321433 Thursday, June 8, 2017 Approved
Chocolatey 0.10.6.1 847809 Saturday, June 3, 2017 Approved
Chocolatey 0.10.6 413283 Thursday, June 1, 2017 Approved
Chocolatey 0.10.6-beta-20170531 984 Thursday, June 1, 2017 Approved
Chocolatey 0.10.6-beta-20170503 8192 Wednesday, May 3, 2017 Approved
Chocolatey 0.10.5 18050360 Thursday, March 30, 2017 Approved
Chocolatey 0.10.4 174242 Thursday, March 30, 2017 Approved
Chocolatey 0.10.4-beta1-20170326 868 Sunday, March 26, 2017 Approved
Chocolatey 0.10.4-beta1-20170323 722 Thursday, March 23, 2017 Approved
Chocolatey 0.10.3 25541696 Friday, October 7, 2016 Approved
Chocolatey 0.10.2 686011 Friday, September 30, 2016 Approved
Chocolatey 0.10.1 2005565 Monday, September 19, 2016 Approved
Chocolatey 0.10.0 3815809 Thursday, August 11, 2016 Approved
Chocolatey 0.9.10.3 1920488 Thursday, June 23, 2016 Approved
Chocolatey 0.9.10.2 2947 Sunday, June 19, 2016 Approved
Chocolatey 0.9.10.1 894 Saturday, June 18, 2016 Approved
Chocolatey 0.9.10 2337 Friday, June 17, 2016 Approved
Chocolatey 0.9.10-rc1 671 Monday, June 13, 2016 Approved
Chocolatey 0.9.10-beta-20160612 636 Sunday, June 12, 2016 Approved
Chocolatey 0.9.10-beta-20160531 630 Tuesday, May 31, 2016 Approved
Chocolatey 0.9.10-beta-20160528 589 Saturday, May 28, 2016 Approved
Chocolatey 0.9.10-beta-20160527 669 Friday, May 27, 2016 Approved
Chocolatey 0.9.10-beta-20160524 640 Wednesday, May 25, 2016 Approved
Chocolatey 0.9.10-beta-20160509 727 Monday, May 9, 2016 Approved
Chocolatey 0.9.10-beta-20160506 651 Friday, May 6, 2016 Approved
Chocolatey 0.9.10-beta-20160505 606 Thursday, May 5, 2016 Approved
Chocolatey 0.9.10-beta-20160503 619 Tuesday, May 3, 2016 Approved
Chocolatey 0.9.10-beta-20160422 960 Friday, April 22, 2016 Approved
Chocolatey 0.9.10-beta-20160411 1091 Monday, April 11, 2016 Approved
Chocolatey 0.9.10-beta-20160402 1026 Saturday, April 2, 2016 Approved
Chocolatey 0.9.10-beta-20160330 645 Thursday, March 31, 2016 Exempted
Chocolatey 0.9.10-beta-20160328 758 Tuesday, March 29, 2016 Approved
Chocolatey 0.9.10-beta-20160325 786 Friday, March 25, 2016 Approved
Chocolatey 0.9.10-beta-20160323 818 Wednesday, March 23, 2016 Approved
Chocolatey 0.9.10-beta-20160322 596 Wednesday, March 23, 2016 Approved
Chocolatey 0.9.10-beta-20160320 790 Sunday, March 20, 2016 Approved
Chocolatey 0.9.10-beta-20160318 686 Friday, March 18, 2016 Approved
Chocolatey 0.9.10-beta-20160314 832 Monday, March 14, 2016 Approved
Chocolatey 0.9.10-beta-20160311 754 Friday, March 11, 2016 Approved
Chocolatey 0.9.10-beta-20160302 971 Wednesday, March 2, 2016 Approved
Chocolatey 0.9.10-beta-20160215 1106 Monday, February 15, 2016 Approved
Chocolatey 0.9.10-beta-20160212 908 Friday, February 12, 2016 Approved
Chocolatey 0.9.10-beta-20160205 1020 Friday, February 5, 2016 Approved
Chocolatey 0.9.9.12 387177 Friday, March 18, 2016 Approved
Chocolatey 0.9.9.11 8574043 Tuesday, October 6, 2015 Approved
Chocolatey 0.9.9.10 382150 Saturday, October 3, 2015 Approved
Chocolatey 0.9.9.9 1252690 Friday, October 2, 2015 Approved
Chocolatey 0.9.9.8 5627937 Saturday, June 27, 2015 Approved
Chocolatey 0.9.9.7 194910 Saturday, June 20, 2015 Approved
Chocolatey 0.9.9.6 831180 Sunday, May 17, 2015 Approved
Chocolatey 0.9.9.5 546953 Monday, April 20, 2015 Approved
Chocolatey 0.9.9.4 515945 Monday, March 30, 2015 Approved
Chocolatey 0.9.9.3 3517 Sunday, March 29, 2015 Approved
Chocolatey 0.9.9.2 25792 Saturday, March 7, 2015 Approved
Chocolatey 0.9.9.1 8512 Tuesday, March 3, 2015 Approved
Chocolatey 0.9.9 14607 Tuesday, March 3, 2015 Approved
Chocolatey 0.9.9-rc9 826 Saturday, February 28, 2015 Approved
Chocolatey 0.9.9-rc8 883 Tuesday, February 24, 2015 Approved
Chocolatey 0.9.9-rc5 1070 Monday, February 9, 2015 Approved
Chocolatey 0.9.9-rc4 750 Sunday, February 8, 2015 Approved
Chocolatey 0.9.9-rc3 718 Saturday, February 7, 2015 Approved
Chocolatey 0.9.9-rc2 677 Friday, February 6, 2015 Approved
Chocolatey 0.9.9-rc1 710 Wednesday, February 4, 2015 Approved
Chocolatey 0.9.9-beta3-20150204 652 Wednesday, February 4, 2015 Approved
Chocolatey 0.9.9-beta2-20150202 699 Monday, February 2, 2015 Approved
Chocolatey 0.9.9-beta-20150201 690 Sunday, February 1, 2015 Approved
Chocolatey 0.9.9-alpha-20150201 683 Sunday, February 1, 2015 Approved
Chocolatey 0.9.9-alpha-20150125 902 Sunday, January 25, 2015 Approved
Chocolatey 0.9.8.33 1795147 Wednesday, February 11, 2015 Approved
Chocolatey 0.9.8.32 263346 Thursday, January 22, 2015 Approved
Chocolatey 0.9.8.31 190536 Wednesday, January 7, 2015 Approved
Chocolatey 0.9.8.31-beta2 706 Wednesday, January 7, 2015 Approved
Chocolatey 0.9.8.31-beta1 632 Tuesday, January 6, 2015 Approved
Chocolatey 0.9.8.30-beta1 626 Tuesday, January 6, 2015 Approved
Chocolatey 0.9.8.29 56996 Friday, January 2, 2015 Approved
Chocolatey 0.9.8.29-beta2 626 Friday, January 2, 2015 Exempted
Chocolatey 0.9.8.29-beta1 636 Friday, January 2, 2015 Exempted
Chocolatey 0.9.8.29-alpha1 679 Friday, January 2, 2015 Exempted
Chocolatey 0.9.8.28 812223 Tuesday, November 4, 2014 Approved
Chocolatey 0.9.8.28-rc1 646 Sunday, November 2, 2014 Exempted
Chocolatey 0.9.8.28-alpha3 1199 Monday, October 6, 2014 Approved
Chocolatey 0.9.8.28-alpha2 1495 Friday, August 1, 2014 Approved
Chocolatey 0.9.8.28-alpha1 717 Wednesday, July 30, 2014 Approved
Chocolatey 0.9.8.27 1382108 Monday, July 14, 2014 Approved
Chocolatey 0.9.8.27-beta1 655 Sunday, July 13, 2014 Approved
Chocolatey 0.9.8.26 933 Saturday, July 12, 2014 Approved
Chocolatey 0.9.8.26-alpha2 706 Friday, July 11, 2014 Approved
Chocolatey 0.9.8.26-alpha1 710 Friday, July 11, 2014 Approved
Chocolatey 0.9.8.25 39006 Monday, July 7, 2014 Approved
Chocolatey 0.9.8.25-alpha1 715 Saturday, July 5, 2014 Approved
Chocolatey 0.9.8.24 13980 Thursday, July 3, 2014 Approved
Chocolatey 0.9.8.24-rc2 716 Monday, June 30, 2014 Approved
Chocolatey 0.9.8.24-rc1 752 Wednesday, June 25, 2014 Approved
Chocolatey 0.9.8.24-beta2 895 Sunday, June 8, 2014 Approved
Chocolatey 0.9.8.24-beta1 1536 Thursday, April 3, 2014 Approved
Chocolatey 0.9.8.24-alpha2 949 Sunday, March 2, 2014 Approved
Chocolatey 0.9.8.24-alpha1 825 Tuesday, February 11, 2014 Approved
Chocolatey 0.9.8.23 525848 Monday, November 11, 2013 Approved
Chocolatey 0.9.8.22 1463 Monday, November 11, 2013 Approved
Chocolatey 0.9.8.22-alpha1 726 Saturday, November 9, 2013 Approved
Chocolatey 0.9.8.21 4370 Friday, November 8, 2013 Approved
Chocolatey 0.9.8.21-beta2 704 Friday, November 8, 2013 Approved
Chocolatey 0.9.8.21-alpha7 964 Friday, August 23, 2013 Approved
Chocolatey 0.9.8.21-alpha6 703 Thursday, August 22, 2013 Approved
Chocolatey 0.9.8.21-alpha5 689 Wednesday, August 21, 2013 Approved
Chocolatey 0.9.8.21-alpha4 672 Wednesday, August 21, 2013 Approved
Chocolatey 0.9.8.21-alpha3 832 Tuesday, July 23, 2013 Approved
Chocolatey 0.9.8.21-alpha2 811 Thursday, June 27, 2013 Approved
Chocolatey 0.9.8.21-alpha1 824 Thursday, May 30, 2013 Approved
Chocolatey 0.9.8.20 331568 Tuesday, December 11, 2012 Approved
Chocolatey 0.9.8.20-beta1 789 Wednesday, December 5, 2012 Approved
Chocolatey 0.9.8.20-alpha3 804 Friday, November 16, 2012 Approved
Chocolatey 0.9.8.20-alpha2 762 Tuesday, October 16, 2012 Approved
Chocolatey 0.9.8.20-alpha1 786 Sunday, September 16, 2012 Approved
Chocolatey 0.9.8.19 29937 Monday, July 2, 2012 Approved
Chocolatey 0.9.8.19-alpha1 735 Thursday, June 28, 2012 Approved
Chocolatey 0.9.8.18 2181 Saturday, June 16, 2012 Approved
Chocolatey 0.9.8.17 1073 Friday, June 15, 2012 Approved
Chocolatey 0.9.8.17-rc2 877 Wednesday, June 13, 2012 Approved
Chocolatey 0.9.8.17-rc1 883 Wednesday, June 13, 2012 Approved
Chocolatey 0.9.8.17-beta1 847 Thursday, June 7, 2012 Approved
Chocolatey 0.9.8.16 7336 Monday, February 27, 2012 Approved
Chocolatey 0.9.8.15 913 Monday, February 27, 2012 Approved
Chocolatey 0.9.8.15-beta2 910 Saturday, February 25, 2012 Approved
Chocolatey 0.9.8.14 2297 Monday, February 6, 2012 Approved
Chocolatey 0.9.8.13 1859 Sunday, January 8, 2012 Approved
Chocolatey 0.9.8.12 2033 Sunday, November 20, 2011 Approved
Chocolatey 0.9.8.11 1874 Friday, October 14, 2011 Approved
Chocolatey 0.9.8.10 1720 Saturday, September 17, 2011 Approved
Chocolatey 0.9.8.9 995 Saturday, September 10, 2011 Approved
Chocolatey 0.9.8.8 847 Saturday, September 10, 2011 Approved
Chocolatey 0.9.8.7 899 Friday, September 2, 2011 Approved
Chocolatey 0.9.8.6 1740 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.8.5 880 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.8.4 1044 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.8.3 900 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.8.2 1107 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.8.1 906 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.8 3988 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.7.3 967 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.7.2 926 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.7.1 923 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.7 945 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.6.4 900 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.6.3 860 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.6.2 931 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.6.1 924 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.6.0 905 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.5.0 937 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.4.0 994 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.3.0 928 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.2.0 908 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.1.0 950 Tuesday, August 23, 2011 Approved
Chocolatey 0.9.0.0 920 Tuesday, August 23, 2011 Approved
Chocolatey 0.8.0.0 995 Tuesday, August 23, 2011 Approved
Chocolatey 0.7.0.0 1313 Tuesday, August 23, 2011 Approved

See all - https://github.com/chocolatey/choco/blob/master/CHANGELOG.md

0.9.9.12

BUG FIXES

  • Fix - PowerShell "Collection is read-only" - see #659

0.9.9.11

BUG FIXES

  • Fix - Pin list is broken - see #452

0.9.9.10

Not to be confused with 0.9.10 (this is not that version). This fixes a small but extremely significant issue with relation to configuration managers and other tools that use choco.

BUG FIXES

  • Fix - List output for other tools messed up in 0.9.9.9 (pipe separator missing) - see #450
  • Fix - accidentally escaped characters in "new" -help - see #447

0.9.9.9

With this release you can completely configure choco from the command line (including the priority of sources). Choco now allows you to create custom package templates. Choco has proper proxy support now. We also squashed up some bugs, like the infinite download loop that happens if the connection is lost. We've also improved the installation experience of Chocolatey itself, unpacking all of the required setup files in the chocolatey package and improving the messaging output during the bootstrapping process. Chocolatey also doesn't try to write config updates every command, unless something actually changes in the config file. And last but not least for mentions, the issue of choco not recognizing itself as needing upgraded after being installed by the bootstrapper is now fixed.

FEATURES

  • Config Command - see #417
  • Create Custom Package Templates - see #76
  • Proxy Support - see #243

BUG FIXES

  • Fix - [Security] Remove rollback should validate it exists in choco install backup directory - see #387
  • Fix - Ensure chocolatey is installed into the lib folder during initial install - see #414
  • Fix - Infinite loop downloading files if connection is lost - see #285
  • Fix - list / search results blocking until completion instead of streaming output - see #143
  • Fix - default template install script for MSI silentArgs are bad - see #354
  • Fix - Deleting read-only files fails - see #338 and #263
  • Fix - If the package uses $packageParameters instead of $env:PackageParameters, quotes are removed - see #406
  • Fix - Choco upgrade not downloading new installer if current installer is the same size - see #405
  • Fix - Exit with non-zero code if install/upgrade version and a newer version is installed - see #365
  • Fix - Chocolately can permanently corrupt the config file if an operation is interrupted - see #355
  • Fix - Handle PowerShell's InitializeDefaultDrives Error (that should just be a warning) - see #349
  • Fix - Checksumming can not be turned off by the feature flag - see #33
  • Fix - Process with an id of is not running errors on 0.9.9.8 - see #346
  • Fix - Export cmdlets for automation scripts - see #422

IMPROVEMENTS

  • [Security] Add SHA-2 (sha256 / sha512) to checksum - see #113
  • Sources should have explicit priority order- see #71
  • Unpack the powershell files just before packaging up the nupkg (Installing chocolatey meta) - see #347
  • API - List --localonly not working by default - see #223
  • API - Expose package results - see #132
  • API - Externalize IPackage and its interfaces - see #353
  • Enhance "Access to path is denied" message on no admin rights - see #177
  • Only update chocolatey.config if there are changes - see #364
  • Modify source when attempting to add a source with same name but different URL - see #88
  • Features should contain description - see #416
  • Chocolatey Installer - removing modules not loaded - see #442
  • Chocolatey Installer - Don't use Write-Host - see #444
  • Set environment variables once configuration is complete - see #420
  • Enhance Package Template for 0.9.9.9 - see #366

0.9.9.8

BUG FIXES

  • Fix: choco install -y C: deletes all files - see #341
  • Fix: Read-Host halts scripts rather than prompt for input - see #219

IMPROVEMENTS

  • Download Progress Bar is Missing - see #56

0.9.9.7

"Fix Everything. Fix All The Things" - There have been some things bugging us for a long time related to limitations with NuGet, so we decided to fix that. Like nuspec enhancements, that crazy content folder restriction has been removed (I know, right?!), and we're working around badly behaved packages quite a bit more to bring you more feature parity.

Let's talk about a couple of big, like really big, BIG features just added with this release. No more packages rebooting Windows. We fixed (#304 / #323) and enhanced up the Auto Uninstaller Service quite a bit to ensure things are working like you would expect (It goes on by default in 0.9.10 - we'll start documenting more about it soon). But wait, there's more! I haven't even told you about the big features yet

The first big feature is enhancing the nuspec. I mentioned this I know, but now you can use packageSourceUrl in the nuspec to tell folks where you are storing the source for the package! We also added projectSourceUrl, docsUrl, mailingListUrl, and bugTrackerUrl. What's even better is that the community feed has already been enhanced to look for these values. So have the templates from choco new. And it's backwards compatible, meaning you can still install packages that have these added nuspec enhancements without issue (but we will need to provide a fix for Nuget Package Explorer).

The second is Xml Document Transformations (XDT), which I think many folks are aware of but may not realize what it can provide. NuGet has allowed transformations for quite awhile to allow you to make changes to an app.config/web.config on install/uninstall. We are following in similar footsteps to allow you to do similar when installing/upgrading packages. We will look for *.install.xdt files in the package (doesn't matter where) and they will apply to configuration files with the same name in the package. This means that during upgrades we won't overwrite configuration files during upgrades that have opted into this feature. It allows you to give users a better experience during upgrades because they won't need to keep making the same changes to the xml config files each time they upgrade your package.

FEATURES

  • Allow XDT Configuration Transforms - see #331
  • Prevent reboots - see #316
  • Enhance the nuspec - first wave - see #205
  • Uninstaller Service Enhancements - see #305

BUG FIXES

  • When uninstall fails, do not continue removing files - see #315
  • Do not run autouninstaller if the package result is already a failure - see #323
  • Fix - Auto Uninstaller can fail if chocolateyUninstall.ps1 uninstalls prior to it running - see #304
  • Fix - Packages with content folders cannot have a dependency without also having a content folder - see #290
  • Remove ShimGen director files on upgrade/uninstall - see #326
  • If feature doesn't exist, throw an error - see #317
  • Fix - The operation completed successfully on stderr - see #249
  • Fix - When specific nuget version is needed by a package it is the chocolatey version that is used - see #194
  • When installing with *.nupkg, need to get package name from package, not file name - see #90
  • Fix - Choco pin list is not returning a list - see #302
  • Fix - A pin is not created for existing installations (prior to new choco) - see #60

IMPROVEMENTS

  • Allow upgrade to always install missing packages - see #300
  • Enhance Templates - see #296
  • Always log debug output to the log file - see #319
  • Warn when unable to snapshot locked files - see #313
  • Use %systemroot% in place of %windir%. PATH exceed 2048 breaks choco - see #252

0.9.9.6

Some really large fixes this release, especially removing all files that are installed to the package directory if they haven't changed, including ensuring that the nupkg file is always removed on successful uninstalls. The really big add some folks are going to like is the new outdated command. Some more variables that were misused have been brought back, which allows some packages (like Atom) to be installed again without issue. If you can believe some people never read these, we decided to add a note to the installer prompt to let people know about -y.

FEATURES

  • Outdated Command - Use choco outdated to see outdated packages - see #170

BUG FIXES

  • Fix - NotSilent Switch Not Working - see #281
  • Fix - Silent installation of choco without admin is not possible - see #274
  • Fix - Package resolves to latest version from any source - see #279
  • Fix - Install fails when shortcut creation fails - see #264
  • Fix - Error deserializing response of type Registry - see #257
  • Fix - Auto uninstaller should not depend on optional InstallLocation value - see #255
  • Fix - Nupkg is left but reported as successfully uninstalled by NuGet - see #254
  • Fix - SHA1 checksum compared as MD5 for Install-ChocolateyZipPackage - see #253
  • Fix - Auto uninstaller strips off "/" and "-" in arguments - see #212

IMPROVEMENTS

  • Uninstall removes all installed files if unchanged - see #121
  • Auto uninstaller should convert /I to /X for Msi Uninstalls - see #271
  • Bring back more variables for feature parity - see #267
  • Mention -y in the prompt - see #265

0.9.9.5

BREAKING CHANGES

  • Renamed short option p to i for list --include-programs so that p could be ubiquitous for password across commands that optionally can pass a password - see #240

BUG FIXES

  • Fix - Secure Sources Not Working - see #240
  • Fix - Generate-BinFile / Remove-BinFile - see #230
  • Fix - cpack should only include files from nuspec - see #232
  • Fix - cpack should leave nupkg in current directory - see #231
  • Fix - Install-PowerShellCommand uses incorrect path - see #241
  • Fix - choco list source with redirects does not resolve - see #171
  • Fix - choco tried to resolve disabled repo - see #169
  • Fix - cpack nuspec results in "The path is not of a legal form" - see #164
  • Fix - cpack hangs on security related issue - see #160
  • Fix - spelling error in "package has been upgradeed successfully" - see #64

IMPROVEMENTS

  • Api Key and Source matching could be more intuitive - see #228
  • Remove warning about allowGlobalConfirmation being enabled - see #237
  • Include log file path when saying 'See the log for details' - see #187
  • Uninstall prompts for version when there is only one installed - see #186
  • Do not offer a default option when prompting for a user choice - see #185
  • Remove the warning note about skipping, and instead show the warning when selecting skip - see #183
  • Do not print PowerShell install/update scripts by default - see #182

0.9.9.4

BUG FIXES

  • Fix - The term 'false' is not recognized as the name of a cmdlet - see #215

IMPROVEMENTS

  • Some packages use non-API variables like $installArguments - see #207

0.9.9.3

BUG FIXES

  • Fix - Install .NET Framework immediately during install - see #168
  • Fix - Do not error on Set-Acl during install/upgrade - see #163
  • Fix - Do not escape curly braces in powershell script - see #208
  • Fix - Formatting issues on --noop command logging - see #202
  • Fix - Uninstaller check doesn't find 32-bit registry keys - see #197
  • Fix - Uninstaller errors on short path to msiexec - see #211

IMPROVEMENTS

  • Some packages use non-API variables like $installArguments - see #207
  • Add Generate-BinFile to Helpers (widely used but never part of API) - see #145
  • Add Remove-BinFile to Helpers - see #195
  • Get-ChocolateyWebFile should create path if it doesn't exist - see #167

0.9.9.2

BUG FIXES

  • Fix - Allow passing install arguments again (regression in 0.9.9 series) - see #150
  • Fix - Allow apostrophes to be used as quotes - quoting style that worked with previous client - see #141
  • Fix - Shims write errors to stderr - see #142 and ShimGen #14

IMPROVEMENTS

  • Upgrade -r should always return a value - see #153

0.9.9.1

BUG FIXES

  • Fix - Get-BinRoot broken - see #144

0.9.9

This also includes issues that were being tracked in the old Chocolatey repository: Chocolatey 0.9.9.

The two links above will not capture everything that has changed, since this is a complete rewrite. We broke everything. If this were a v1+, it would be a major release. But we are less than v1, so 0.9.9 it is! ;)

Okay, so we didn't really break everything. We have maintained nearly full compatibility with how you pass options into choco, although the output may be a bit different (but better, we hope) and in at least one case, additional switches (or a feature setting) is/are required - we limited this to security related changes only.

We also fixed and improved a bunch of things, so we feel the trade off is well worth the changes.

We'll try to capture everything here that you should know about. Please call choco -? or choco.exe -h to get started.

KNOWN ISSUES

  • Known Issues
  • TEMPORARY install all is missing - this is expected to be back in 0.9.10 - see #23
  • Alternative sources (webpi,ruby,python,cygwin, windowsfeature) do not work yet. This is expected to be fixed in 0.9.10 - see #14
  • Progress bar is missing when downloading until we are using internal posh components for Packages - see #56
  • See Feature Parity for items not yet reimplemented from older PowerShell Chocolatey client (v0.9.8.32 and below).

BREAKING CHANGES

  • [Security] Prompt for confirmation: For security reasons, we now stop for confirmation before changing the state of the system on most commands. You can pass -y to confirm any prompts or set a value in the config that will globally confirm - see #52 (NOTE: This is one of those additional switches we were talking about)
  • [Security] If your default installation is still at c:\Chocolatey, this version will force a move to ProgramData and update the environment settings - see #7
  • Configuration Breaking Changes:
    1. You now have one config file to interact with in %ChocolateyInstall%\config - your user config is no longer valid and can be removed once you migrate settings to the config.
    2. The config will no longer be overwritten on upgrade.
    3. Choco no longer interacts with NuGet's config file at all. You will need to reset all of your apiKeys (see features for apikey). On the plus side, the keys will work for all users of the machine, unlike NuGet's apiKeys (only work for the user that sets them).
    4. This also means you can no longer use useNugetForSources. It has been removed as a config setting.
  • Packaging Changes:
    1. Choco now installs packages without version numbers on folders. This means quite a few things...
    2. Upgrading packages doesn't install a new version next to an old version, it actually upgrades.
    3. Dependencies resolve at highest available version, not the minimum version as before - see Chocolatey #415
  • Package Maintenance Changes:
    1. Read the above about apikey changes
    2. Read above about dependency resolution changes.
  • Deprecated/Removed Commands:
    1. installmissing has been removed. It was deprecated awhile ago, so this should not be a surprise.
    2. choco version has been deprecated and will be removed in v1. Use choco upgrade pkgName --noop or choco upgrade pkgName -whatif instead.
    3. Write-ChocolateySuccess, Write-ChocolateyFailure have been deprecated.
    4. update is now upgrade. update has been deprecated and will be removed/replaced in v1. Update will be reincarnated later for a different purpose. Hint: It rhymes with smackage pindexes.

FEATURES

BUG FIXES

Probably a lot of bug fixes that may not make it here, but here are the ones we know about.

IMPROVEMENTS

  • [Security] Allow keeping c:\chocolatey install directory with environment variable - see #17
  • [Security] Require switch on unofficial build - see #36
  • Install script updates - see #7
  • Ensure Chocolatey pkg is installed properly in lib folder - This means you can take a dependency on a minimum version of Chocolatey (we didn't like that before) - see #19
  • Uninstall - allow abort - see #43
  • Support for HTTPS basic authorization - see Chocolatey #128
  • Smooth out success/failure logging - see Chocolatey #154
  • Add $env:CHOCOLATEY_VERSION - see Chocolatey #251
  • Replace ascii cue with visual cues - see Chocolatey #376
  • Uninstall all versions of an app - see Chocolatey #389
  • Add parameters in packages.config files - see Packages.config, Chocolatey #472, and #10
  • Choco pack should support -version - see Chocolatey #526
  • Enhancements to Start-ChocolateyProcessAsAdmin - see Chocolatey #564
  • Install-ChocolateyFileAssociation - add label to new file types - see Chocolatey #564
  • Clean up the verobsity of Chocolatey - see Chocolatey #374
  • Compact choco upgrade --noop option - see Chocolatey #414
  • Remove references to the Chocolatey gods - see Chocolatey #669
  • Shims now have noop (--shimgen-noop) and help (--shimgen-help) switches - see ShimGen #8 and ShimGen #10
  • Shims will terminate underlying process on termination signal - see ShimGen #11
  • Shims now have gui (--shimgen-gui) and exit (--shimgen-exit) switches - see ShimGen #13 and ShimGen #12
  • Dat help menu tho. I mean srsly guise - see Chocolatey #641

This package has no dependencies.

Discussion for the Chocolatey Package

Ground Rules:

  • This discussion is only about Chocolatey and the Chocolatey package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or Chocolatey, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus