Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / PowerShell

Chocolatey - Package Management for Windows

4.67/5 (2 votes)
22 Mar 2020CPOL2 min read 5.6K  
A quick look at what is Chocolatey and how to install it
In this post, you will take a look at what is Chocolatey and how to install it on your computer. You will also see my Chocolatey script that I used to get my main Windows development environment up and running.

Between 6 months to a year, I start to feel that my Windows installation is running sluggish. Is there some malware running somewhere? Is Windows just getting slow? Either way, I like a fresh installation.

Chocolatey to the rescue of clicking next a thousand times.

What is Chocolatey?

Chocolatey is a package management solution for Windows, similar to npm, apt-get, etc. It means that you don’t have to sit there searching/downloading/running and click next next next, for every individual piece of software you want to install on your computer.

My Disaster Recovery Strategy

Chocolatey is also part of my DR strategy, if my laptop goes bang. It is going to take a day or two for Dell to come out and fix my laptop, so wherever I am, I can drive to a local computer shop, by any decentish laptop and get up and running in the time it takes for chocolatey to run. Most of my important files are synced to OneDrive / NextCloud. So once those have synced, I’m back up and running.

Installing Chocolatey

You will need PowerShell installed, and open up an elevated instance of PowerShell (Run-as administrator).

Copy and paste the following into your PowerShell prompt, and after about 30 seconds, you will have chocolatey available on your system.

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

You will need to shutdown and restart Powershell to be able to first use chocolatey.

My Chocolatey Script

The following script is what I used to get my main Windows development environment up and running.

It is possible to run chocolatey with multiple applications on one line, i.e., choco install app1 app2 app3 but this doesn’t make much of a difference, as all the applications are downloaded and installed in sequence anyway. It would be good for the downloads all to happen as the installations continue. So I’ve separated all the commands out just for readability.

# Install git
choco install git -y

# Install Visual Studio Code
choco install vscode -y

# Instal Visual Studio 2019 Professional
choco install visualstudio2019professional -y

# Install PowerShell Core
choco install powershell-core -y

# Install Azure CLI
choco install azure-cli -y

# Install Azure PowerShell 6.9.0
choco install azurepowershell -y

# Install JetBrains dotPeek
choco install dotpeek -y

# Install Google Chrome
choco install googlechrome -y

# Install firefox
choco install firefox -y

# Install Joplin
choco install joplin -y

# Install VLC
choco install vlc -y

# Install Office 365
choco install office365business -y

# Install Microsoft Teams
choco install microsoft-teams -y

# Install mRemoteNG
choco install mremoteng -y

# Install NextCloud
choco install nextcloud-client -y

# Install Windows Terminal
choco install microsoft-windows-terminal -y

# Install Remote Desktop Connection Manager
choco install rdcman -y

# Install 7-Zip
choco install 7zip -y

# Install Tomighty
choco install tomighty -y

# Install Calibre
Calibre -y

# Install WinDirStat
choco install windirstat -y

# Install Logitech Options (for my mouse/keyboard)
choco install logitech-options -y

# Instal SQL Server Management Studio
choco install sql-server-management-studio -y

# Install paint.net
choco install paint.net -y

# Install qbittorrent
choco install qbittorrent -y

# Install League of Legends
choco install leagueoflegends -y

Conclusion

Chocolatey is a pretty good solution for me, it doesn’t have ALL the software that I need. But it probably has 95% of what I use.

I wish there was a central way to keep configuration and logins. But at least this gets me up and running pretty quickly for a while.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)