Using Chocolatey Package Manager

Chocolatey is a package manager for Windows, much like apt-get on linux. Like all package managers, it allows you to easily install and upgrade applications. Note that not all applications are available, but many are.

Here’s how to use it.

  1. Install the chocolatey package manager
    Open powershell as administrator and execute:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  1. Create a config file.
    Create a folder and create in it a new file called choco.config containing the packages you want to install.
    To find available apps, go to https://community.chocolatey.org/packages or try executing

    choco find [name]

Here's a sample config file: 

<?xml version="1.0" encoding="utf-8"?>
<packages>
	<package id="googlechrome" /> 
	<package id="notepadplusplus" />
	<package id="git" />
	<package id="nodejs" />
	<package id="postman" />
	<package id="visualstudio2019community" />
	<package id="vscode" />
	<package id="vscode-prettier" />
	<package id="firefox" />
	<package id="7zip" />
	<package id="dotnetfx" />
	<package id="nodejs" />
	<package id="selenium" />
	<package id="sysinternals" />
	<package id="beyondcompare" />
</packages>
  1. Process the config file
choco install choco.config -y

The “y” lets the script run without pausing for prompts.


Here’s the output:

Chocolatey installed 31/31 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Installed:
nodejs v16.5.0
git.install v2.32.0.2
vscode.install v1.58.2
kb3033929 v1.0.5
postman v8.7.0
chocolatey-vscode.extension v1.1.0
selenium v3.141.59
visualstudio2019community v16.10.2.0
dotnet4.5.2 v4.5.2.20140902
notepadplusplus v8.1.1
beyondcompare v4.3.7.25118
firefox v89.0.2
dotnetfx v4.8.0.20190930
nodejs.install v16.5.0
kb2999226 v1.0.20181019
7zip v19.0
googlechrome v91.0.4472.124
sysinternals v2021.6.24
notepadplusplus.install v8.1.1
vscode v1.58.2
kb2919442 v1.0.20160915
7zip.install v19.0
vscode-prettier v8.0.1
kb3035131 v1.0.3
kb2919355 v1.0.20160915
git v2.32.0.2
chocolatey-windowsupdate.extension v1.0.4
chocolatey-core.extension v1.3.5.1
chocolatey-visualstudio.extension v1.9.0
chocolatey-dotnetfx.extension v1.0.1
visualstudio-installer v2.0.1
PS C:\coding\chocolatey>

That’s it. All of the applications now are installed.

4. To upgrade (not update!) all installed packages,

PS C:\coding\chocolatey> choco upgrade all -y
Chocolatey v0.10.15
Upgrading the following packages:
all
By upgrading you accept licenses for the packages.
7zip v19.0 is the latest version available based on your source(s).
7zip.install v19.0 is the latest version available based on your source(s).
beyondcompare v4.3.7.25118 is the latest version available based on your source(s).
chocolatey v0.10.15 is the latest version available based on your source(s).
chocolatey-core.extension v1.3.5.1 is the latest version available based on your source(s).
chocolatey-dotnetfx.extension v1.0.1 is the latest version available based on your source(s).
chocolatey-visualstudio.extension v1.9.0 is the latest version available based on your source(s).
chocolatey-vscode.extension v1.1.0 is the latest version available based on your source(s).
chocolatey-windowsupdate.extension v1.0.4 is the latest version available based on your source(s).
DotNet4.5.2 v4.5.2.20140902 is the latest version available based on your source(s).
dotnetfx v4.8.0.20190930 is the latest version available based on your source(s).
Firefox v89.0.2 is the latest version available based on your source(s).
git v2.32.0.2 is the latest version available based on your source(s).
git.install v2.32.0.2 is the latest version available based on your source(s).
GoogleChrome v91.0.4472.124 is the latest version available based on your source(s).
KB2919355 v1.0.20160915 is the latest version available based on your source(s).
KB2919442 v1.0.20160915 is the latest version available based on your source(s).
KB2999226 v1.0.20181019 is the latest version available based on your source(s).
KB3033929 v1.0.5 is the latest version available based on your source(s).
KB3035131 v1.0.3 is the latest version available based on your source(s).
nodejs v16.5.0 is the latest version available based on your source(s).
nodejs.install v16.5.0 is the latest version available based on your source(s).
notepadplusplus v8.1.1 is the latest version available based on your source(s).
notepadplusplus.install v8.1.1 is the latest version available based on your source(s).
postman v8.7.0 is the latest version available based on your source(s).
selenium v3.141.59 is the latest version available based on your source(s).
sysinternals v2021.6.24 is the latest version available based on your source(s).
visualstudio-installer v2.0.1 is the latest version available based on your source(s).
visualstudio2019community v16.10.2.0 is the latest version available based on your source(s).
vscode v1.58.2 is the latest version available based on your source(s).
vscode-prettier v8.0.1 is the latest version available based on your source(s).
vscode.install v1.58.2 is the latest version available based on your source(s).

— END —

You may also like...