For the holidays this year we put together a fun fact or interesting feature each day during December. We called it the 24 TIL's of Chocolatey.
A TIL is a commonly used acronym for today I leared. Which is apt, because we posted in our Discord today-i-learned channel alongside Twitter. But, in case you missed them here is each TIL listed below in order:
- Day 1: Chocolatey was first released on 23 March 2011. That makes Chocolatey 10 years old!
- Day 2: If you already have software installed on your computer, but you want to manage it with Chocolatey going forward, then there is a solution to it without installing the software again. One way of doing this is to use the
--skip-powershell
switch. By runningchoco install vlc --skip-powershell
, Chocolatey CLI will install the latest vlc package, but not run any of the PowerShell scripts, includingchocolateyInstall.ps1
. So the software won't actually be installed again. Once that is done you can runchoco upgrade vlc
to upgrade to the next latest version when it's available! - Day 3: You can enable PowerShell tab completion for use with Chocolatey CLI. Find out more in our docs, or watch this fantastic video created by our Senior Software Developer, Gary Ewan Park.
- Day 4: Windows requires the majority of software installations to be done with elevated privileges. Chocolatey works really well when combined with gsudo, so that you can run
sudo choco install <packageName>
from a non-elevated terminal! - Day 5: Did you know you can extend the functionality of the Chocolatey CLI using extensions? Extensions are PowerShell modules that are created as Chocolatey packages and installed, upgraded and uninstalled in the familiar way! See the docs for more information.
- Day 6: Chocolatey remembers arguments previously used during package installations and can reuse these arguments during upgrade by enabling the feature
useRememberedArgumentsForUpgrades
(runningchoco feature enable --name=useRememberedArgumentsForUpgrades
) or by passing in the switch--use-remembered-arguments
. See the docs for more information. - Day 7: Did you know that you can extend the
choco new
command to use your own custom templates? This makes creating tailored Chocolatey packages, with your own conventions, really simple! See the docs for more information. - Day 8: Did you know that the Chocolatey documentation site is fully open source? And we welcome contributions! You can learn how to contribute using this video playlist.
- Day 9: Did you know that if you run
choco upgrade <packagename>
that Chocolatey CLI will helpfully install the package if it's not already installed? If you want to turn off this behaviour, then runchoco feature enable --name=skipPackageUpgradesWhenNotInstalled
to enable the feature. See the docs for more information. - Day 10: Did you know that if you are a Chocolatey For Business customer, you can pin a package and store the reason why? Add the
--pin-reason=<NOTE>
switch to the normalchoco pin
command to do so! See the docs for more information. - Day 11: Did you know that Chocolatey For Business customers can add their organizational logo to Chocolatey GUI? See the docs for more information.
- Day 12: Did you know that the Chocolatey Automatic Uninstaller attempts to uninstall the software a package may have installed, even if the package does not include an uninstall script? You can manage its behaviour using the
autoUninstaller
feature. See the docs for more information. - Day 13: Did you know that in Chocolatey For Business you can use auditing to find out who installed a package and when? Just run
choco list -lo --audit
. If it was installed through Self Service it will show you the original requesting user as well! See the docs for more information. - Day 14: Chocolatey includes its own PowerShell Host that will time out calls to
Read-Host
or any other prompt for choice when-y
is passed. This means you can prompt the user during package install / upgrade if necessary, but it will not block headless deployments. You can use the system PowerShell host using the--use-system-powershell
switch or by enabling thepowershellHost
feature. See the docs for more information. - Day 15: Did you know that Chocolatey supports FIPS compliant organizations? Simply enable the
useFipsCompliantChecksums
feature to use FIPS compliant generated checksums. See the docs for more information. - Day 16: Did you know you can add all the Chocolatey packages you want to install, with parameters, to a
packages.config
file and install them with one command? This is fantastic when you get a new computer! See the docs for more information. - Day 17: Did you know Chocolatey CLI provides enhanced exit codes for the search, list, info and outdated commands? Enable the
useEnhancedExitCodes
feature and exit code 2 is returned if the command does not produce any results. This is really handy in scripts! See the docs on the individual commands for more information. - Day 18: If you use Chocolatey For Business in Self-Service / Background Mode you can restrict the commands / actions that end users can perform by configuring
backgroundServiceAllowedCommands
. By default install and upgrade are allowed but uninstall is not! See the docs for more information. - Day 19: Did you know in Chocolatey CLI you can stop install, upgrade or uninstall of packages when a reboot request is detected. Simply enable the features
useEnhancedExitCodes
andexitOnRebootDetected
. See the docs for more information. - Day 20: Did you know you can export your currently installed packages in Chocolatey GUI using the Export button? Did you know can also do this in Chocolatey CLI using the
export
command? Once the export is complete, you will have apackages.config
file you can use in achoco install packages.config
command on any other computer! See the docs for Chocolatey GUI and Chocolatey CLI. - Day 21: Chocolatey shims executables to keep your PATH clear and runs the target where it is, meaning required dependencies are all used from the original location! We like to call this "batch redirection that works". See the docs for more information.
- Day 22: Did you know that Chocolatey For Business can show all installed Chocolatey packages in Programs and Features on Windows? This allows reporting tools that only see Programs and Features software, to report on Chocolatey packages too! Simply enable the
showAllPackagesInProgramsAndFeatures
feature. See the docs for more information. - Day 23: Did you know that you can add parameters to a package when you create it? Package parameters is one of the most powerful features of Chocolatey packages! It allows the installation / upgrade to be customised by allowing the user to provide information to the package in the form of license names, keys or even switches to allow, for example, shortcuts to be created on the desktop (or not). Whatever your imagination allows! We even provide a Chocolatey helper function
Get-PackageParameters
to help you parse them! See the docs for more information on creating Package Parameters and on the Chocolatey helper. - Day 24: Did you know that the Chocolatey Community Repository hit 1 BILLION package downloads in May 2020 and is at 1.6 BILLION today? See our blog post for that milestone and the Chocolatey Community Repository timeline (work in progress).
We hope you learned some things from our TIL's this December.
While 2021 will go down in the history books as a difficult year for all of us, we're excitedly looking forward to what is to come in 2022 and how we can continue to empower our customers with the power of simple.
Popular Tags
- #news 69 Number of post with tag news
- #press release 56 Number of post with tag press release
- #chocolatey for business 44 Number of post with tag chocolatey for business
- #packaging 21 Number of post with tag packaging
- #open source 17 Number of post with tag open source
- #community 15 Number of post with tag community
- #tutorial 14 Number of post with tag tutorial
- #12 days of Chocolatey 2023 12 Number of post with tag 12 days of Chocolatey 2023
- #chocolatey community repository 12 Number of post with tag chocolatey community repository
- #podcast 11 Number of post with tag podcast