Chocolatey Package Manager in Windows 10

  • by

Please refer to the following simple guide on how to use Chocolatey Package Manager in Windows 10

Install Chocolatey in Windows 10

  1. Open PowerShell / PowerShell ISE with Administor Right
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  1. Verify Choco version installed
PS C:\Windows\system32> choco
Chocolatey v0.10.11
  1. Install Applications from https://chocolatey.org/
#Install Applications
choco install winrar -y

#Uninstall Applicatons
choco uninstall winrar -y

#List all Applications installed with Choco
choco list --local-only

#PowerShell Install / Uninstall Script are stored in
#C:\ProgramData\chocolatey\lib
  1. Some of the useful commands

\#Check Choco Source choco source list Chocolatey v0.10.11 chocolatey - https://chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False. #Look for Applications in Choco choco search GoogleChrome Chocolatey v0.10.11 GoogleChrome 71.0.3578.98 [Approved] Downloads cached for licensed users Vivaldi 2.2.1388.37 [Approved] GoogleChrome-AllUsers 26.0.1410.64 GoogleChrome.Canary 28.0.1461.0 [Approved] GoogleChrome.Dev 27.0.1453.12 [Approved] googlechrome-zenhub 1.0.0 [Approved] jivkok.tools 1.1.0.7 - Possibly broken googlechrome-github-expandinizr 1.0.0 [Approved] googlechrome-authy 2.3.0 [Approved] allbrowsers 1.0 - Possibly broken 10 packages found.

What are Chocolatey Package

Chocolatey packages are known as nupkg files, which is a compiled NuSpec or a fancy zip file that knows about package metadata (including dependencies and versioning). These packages are an enhanced NuGet package, they have additional metadata that is specific to Chocolatey. Chocolatey is also compatible with vanilla NuGet packages. A Chocolatey package can contain embedded software and/or automation scripts.

How does Chocolatey work?
A. Installation
1. Chocolatey uses NuGet (NuGet.Core.dll) to retrieve the package from the source
2. The package is installed into $env:ChocolateyInstall\lib\
3. Choco takes a registry snapshot for later comparison
4. Choco compares the snapshot and determines uninstaller information and saves that to a .registry file.
5. Choco snapshots the folder based on all files that are currently in the package directory.

B. Upgrade
1. Similar to install, except choco will make a backup of the package folder (and only the package folder) prior to attempting upgrade.
2. The files snapshot is used to determine what files can be removed from the package folder. If those files have not changed, they will be removed. If the upgrade fails, choco will ask if you want to rollback the package folder to the previous version

C. Uninstall
1. Choco will make a backup of the package folder.
2. If auto uninstaller is turned on, choco will attempt to run the auto uninstaller if a silent uninstall can be determined.
3. If everything is successful so far, the files snapshot is used to determine what files can be removed from the package folder
4. If everything is deleted from the package folder, the folder is also removed.