Basic package deployment using Chocolatey

Ever wished to have a package manager on Windows? Using Chocolatey, you will be able to access either a common repository located online or your own private repo hosted on-premise. Using in addition to automated tools like Ansible, Chef, Puppet or even regular GPO, you will be able to manage your servers and workstations packages like a pro!

This document is just a basic showroom, we will explain how to deploy Chocolatey on your local machine, and run some commands. Later, I will probably update or explain how to manage a local repository.

Installing Chocolatey

It’s very simple, all you need is to open a Powershell v2 command prompt, with administration privilege though, then enter the following command:

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'))

This will set the bypass the execution policy, to avoid being block by the restricted mode, then execute a script remotely downloaded from Chocolatey’s website. I would recommend you to download the script manually before, for checking both the website certificate and the script content.

Once it’s done and installed, restart the Powershell console and enter the following command to see if everything went well:

choco 

You should get something like that:

Chocolatey v0.10.15
Please run 'choco -?' or 'choco <command> -?' for help menu.

Basic commands

Inspect which repositories are set for the current installation:

choco sources

That will show you something like that:

Chocolatey v0.10.15
chocolatey - https://chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.

Look for a specific packet, see the different version:

choco find vlc

Install the packet you just found:

choco install notepadplusplus

Uninstall a packet:

choco uninstall mpc-hc

Upgrade all the packages:

choco upgrade all

That’s all for now, I will update this topic later. However, you should have seen how easy it is to deploy packages now, and how great it is if you want to create scripts to ease a post server/workstation installation for example.

Desktop template

Here I drop the classic packages I usually install on my workstations, so I don’t need to remember everything.

choco install 7zip adobereader googlechrome greenshot notepadplusplus skype teamviewer treesizefree mpc-hc openssl putty nodejs git lavfilters mremoteng postman vscode wireshark anki discord libreoffice naps2 -y

Leave a Reply