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

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!

Learn More Register Now

Chocolatey Community Coffee Break

Join the Chocolatey Team on our regular monthly stream where we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

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

Announcing Chocolatey Central Management 0.10.0

Livestream from
Thursday, 06 October 2022

We recently released our largest update to Chocolatey Central Management so far. Join Gary and Steph to find out more about Chocolatey Central Management and the new features and fixes we've added to this release.

Watch On-Demand
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
Chocolatey Product Spotlight: Chocolatey 1.2.0 and Chocolatey Licensed Extension 5.0.0

Livestream from
Thursday, 03 November 2022

Join Paul and Gary for this months Chocolatey product livestream where we look at the latest release of Chocolatey 1.2.0, Chocolatey Licensed Extension 5.0.0 and shine a spotlight on the new hook scripts functionality. This opens up so many possibilities for Chocolatey CLI users!

Watch On-Demand
Chocolatey Coding Livestream

Livestream from
Tuesday, 29 November 2022

Join Josh as he adds the ability to manage Chocolatey GUI config and features with the Chocolatey Ansible Collection.

Watch On-Demand
Introduction into Chocolatey with Veeam

Webinar from
Tuesday, 13 December 2022

Join Gary, Paul, and Maurice as they introduce and demonstrate how to use Chocolatey! Questions will be answered live in an Ask Me Anything format.

Watch On-Demand

How Chocolatey Works

Installation

  1. Chocolatey uses NuGet (NuGet.Core.dll) to retrieve the package from the source. This is typically a nupkg that is stored in a folder, share, or an OData location (HTTP/HTTPS). For more information on sources, please see Sources and Source Repositories.
  2. The package is installed into $env:ChocolateyInstall\lib\<pkgId>. The package install location is not configurable: the package must install to this location for tracking, upgrade, and uninstall purposes. The software that may be installed later during this process is configurable. See Terminology to understand the difference between "package" and "software" when related to Chocolatey.
  3. Chocolatey determines if the package is self-contained or if it has automation scripts. Currently these automation scripts are limited to PowerShell scripts (*.ps1 files) but other formats may be possible in future releases.
  4. Chocolatey takes a registry snapshot for later comparison.
  5. If there are automation scripts, Chocolatey runs them. You have the full capability of PowerShell, but you should try to ensure they are compatible with PowerShell v2 and beyond.
  6. Chocolatey compares the snapshot, determines uninstaller information, and saves that to a .registry file.
  7. Chocolatey snapshots the folder based on all files that currently reside in the package directory.
  8. Chocolatey looks for executable files in the package folder and generates shims in the $env:ChocolateyInstall\bin folder to ensure availability on the path. The executable files may have been embedded into the package or downloaded from a remote source and placed there. If there is a shim ignore file (<exeName>.exe.ignore) then Chocolatey will not generate a shim in the bin folder.

Upgrade

  1. Chocolatey will look for and run a chocolateyBeforeModify.ps1 file in the existing package prior to upgrading or uninstalling a package. This is your opportunity to shut down services and/or processes. The chocolateyBeforeModify.ps1 is run from the existing package, not the new version of the package. If it fails, it passes a warning and continues to the next step.
  2. Chocolatey makes a backup of the package folder (and only the package folder) prior to attempting an upgrade.
  3. The snapshot is used to determine which files can be removed from the package folder. If those files have not changed, they will be removed.
  4. If the upgrade fails, Chocolatey will automatically rollback the package folder to the previous version while passing an error message. This does not fix any folders used outside of the package directory, such as where the native installer installed a program; those fixes must be completed by the user. Chocolatey also does not rerun installation scripts on rollback.

Uninstall

  1. Chocolatey makes the determination that the package is actually installed.
  2. Chocolatey will look for and run a chocolateyBeforeModify.ps1 file in the existing package prior to upgrading or uninstalling a package. This is your opportunity to shut down services and/or processes. If it fails, it passes a warning and continues to the next step.
  3. Chocolatey makes a backup of the package folder.
  4. If an automation script is present, Chocolatey runs it. This is used to clean up anything placed by the installation script.
  5. If using the auto-uninstaller, Chocolatey will attempt to automatically uninstall the package if a silent uninstall can be determined. Otherwise, it will prompt the user (unless passed with -y) to continue with uninstallation. The auto-uninstaller can detect approximately 80% of native installers and determine the silent uninstall arguments.
  6. If successful, the snapshot is used to determine what files can be removed from the package folder. If those files have not changed, they will be removed.
  7. If everything has been deleted from the package folder, the folder is also removed.

When a package has an exe file, Chocolatey will create a link "shortcut" to the file (called a shim) so that you can run that tool anywhere on the machine. See shimming for more information.

When a package has a chocolateyInstall.ps1, it will run the script. The instructions in the file can be anything. This is limited only by the .NET framework and PowerShell.

Most of the Chocolatey packages that take advantage of the PowerShell download an application installer and execute it silently.

Test Your Skills!

IMPORTANT

You must be logged in to take this test. Don't have an account yet? Register Now

Log On