Chocolatey: The Easiest Way to Install and Manage Windows Software
Tags: automation, tutorial, codenewbie, opensource
Published: 2024-02-18 17:57:37

Working on Windows has it’s advantages when it comes to software and installing with most programs having a Windows Version available for download every time.

Sometimes that sponsored Google Search link you just clicked is actually the wrong software or worse yet, a malicious malware version of it.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExNTZyZW8xamhyd3NkZWc3aWVtMDZqcTlpdG93M2szejh2MDZuNXo3bCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3oEjHCF6kGlXK0ofsY/giphy.gif">

On Linux, you can use an inbuilt package manager like Apt in Ubuntu to download the latest version from a trusted centralised source. You can install and update it using just the command line.

That’s where the Chocolatey package manager can help to give you that Linux experience on Windows with a tastier way to do things.

![](https://reprodev.com/content/images/2024/02/07-Choco-Intro-01.png)

___

In this guide and overview, we’ll be installing Chocolatey using Windows PowerShell on Windows 11 to start installing our first packages.

We’ll be looking at

-   What is Chocolatey?
-   Install Chocolatey using Windows PowerShell
-   Where and how to search for packages?
-   Install our first package (Google Chrome)
-   Upgrade our first package
-   Uninstall our first package
-   Install several packages at once (Google Chrome, Notepad++ and 7zip)
-   Upgrade several packages at once (Google Chrome, Notepad++ and 7zip)
-   Upgrade all packages installed by Chocolatey
-   Uninstall all packages installed by Chocolatey
-   Check the packages currently installed by Chocolatey
-   Uninstall and remove Chocolatey
-   What about Winget?
-   Chocolate for Automated Windows Virtual Machine Deployment and Configuration

___

## What is Chocolatey?

Chocolatey is a package manager for Windows, that once installed, lets you download and install programs in just a few words using only the command line without you having to do much else.

Instead of having to open a browser and go to the website to download a program like Google Chrome and going through the whole setup process manually, Chocolatey can automate this.

![](https://reprodev.com/content/images/2024/02/07-Choco-Intro-03.png)

Programs are called packages in Chocolatey and you’ll find most programs have a package in the community repository. Some of these being maintained by the developers themselves and are verified to be the latest working versions.

___

## Install Chocolatey on Windows

The install for Chocolatey is similar to the installation of any other package and is done by using a one line command in Windows PowerShell.
[Chocolatey.org Install Link](https://chocolatey.org/install)

![](https://reprodev.com/content/images/2024/02/07-Choco-Install-01..png)

-   Open Windows Powershell and “**Run as administrator**”

![](https://reprodev.com/content/images/2024/02/07-Choco-Install-02.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Install-03.png)

-   Copy the one line command for the Chocolatey installation script below

```undefined
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
```

![](https://reprodev.com/content/images/2024/02/07-Choco-Install-04.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Install-05.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Install-06.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Install-07.png)

-   Once it completes it will bring you back to the Powershell Command Line
-   Type the **choco** command below to check the install is working, call the program and print the current version

`choco`

![](https://reprodev.com/content/images/2024/02/07-Choco-Install-08-1.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Install-09.png)

Congratulations, you’ve now installed the Chocolatey package manager and can start managing packages using the command line on Windows.

___

## Where and How to search for packages?

Chocolatey is a useful tool because of the large number of packages in its repository.

There is one for nearly every piece of software you can think of and you’ll usually be able to find it quite quickly.

You can search for the package you need by either using the command line or if that doesn't work, by searching on their website repository in a browser.

___

### Searching for packages using the command line

We’re going to search for 7zip and we'll be using that later on in the guide

-   Open a Windows PowerShell terminal and “Run as administrator”

![](https://reprodev.com/content/images/2024/02/07-Choco-Software-Search-01..png)

-   Type the below command to search the repository for 7zip

`choco search 7zip`

![](https://reprodev.com/content/images/2024/02/07-Choco-Software-Search-02.png)

-   This will bring a list of search results for the program and if you scroll back up to the top you’ll find it’s usually the first result with a version number after it.

![](https://reprodev.com/content/images/2024/02/07-Choco-Software-Search-03.png)

-   These will also have notes in the right hand side telling you if they are approved, broken or have been replaced by a new package.
-   We can scroll back up the list to see the whole list of packages.
-   In our case, the first hit is 7zip so that’s going to be the name of the package we would need to use with Chocolatey.

![](https://reprodev.com/content/images/2024/02/07-Choco-Software-Search-04.png)

We'll go over the other way to search for these when we Install our first package, Google Chrome.

___

## Install our first package (Google Chrome)

For our first package we’re going to use is for a piece of software most people will install as part of Windows initial boot up. We’re going to install the **Google Chrome** browser.

We’re going to start by getting the correct package name for **Google Chrome** so we can get it installed

-   Let’s search for **Google Chrome** in the repository using the search command

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-01.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-02.png)

`choco search chrome`

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-03.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-04.png)

-   This brings up **169** packages to choose from.
-   Scrolling up to the top and it doesn’t look like any of these are the correct one so instead we’ll check on the **Community Repository** page.

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-05.png)

-   Open a web browser and go to the **Community Repository**

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-06.png)

-   If we scroll down we can see this as one of the top 5 hits on the page and it’s actually listed as **googlechrome**

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-07.png)

-   We can find this from a search by using that name

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-11.png)

-   Click to get through to the individual project page for this application
-   This page will give you more information on our package for Google Chrome, the last time it was updated and the code we need to paste into our terminal.

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-09.png)

-   Go back to your **Powershell Terminal** to paste the command from this page
-   Run the below command to start the installation

`choco install googlechrome`

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-12.png)

-   It will now start the download of **Google Chrome** but will stop asking if you are sure you want to complete the installation

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-14.png)

-   To confirm the install and run the script you need to type **y**

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-15.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-16.png)

-   Close your **Powershell Terminal** to exit or press **Ctrl+C** to cancel as we're going to do something different

___

### Automating the Single Package install

-   As we want to automate this further then we’re going add one more thing to the choco command
-   Adding the **\-y** switch to the end will say y automatically to as many of the prompts as it can for you
-   Open a new Powershell window as Administrator so we can try this again
-   Type in the below command and Press Enter

`choco install googlechrome -y`

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-17.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-18.png)

-   Time to grab a cup of coffee while Chocolatey does it’s thing

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-19.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-20.png)

-   Once it's finished the install script you can go ahead and find that we've automatically got a Desktop Shortcut to Google Chrome added

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-21.png)

-   It's all been added to our Start Menu

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-22.png)

-   Opening it up for the first time we're greeted with the normal first time run for **Google Chrome** with no noticeable or functional difference to a regular install.

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Install-23.png)

Congratulations, you’ve now installed your first package using Chocolatey. Next up, even though we’ve just installed it let’s look at how to upgrade it.

___

## Upgrade our first package

In most cases you won’t have to upgrade any of your packages manually using Chocolatey as they will tend to update as normal in most cases when you open them up.

-   To upgrade Google Chrome manually using Chocolatey we can use the below command

`choco upgrade googlechrome`

-   Add the **\-y** switch to automate this further

`choco upgrade googlechrome -y`

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Upgrade-01.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Upgrade-02.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Upgrade-03.png)

This will download the latest version from the Community Repository and upgrade the program if there’s one available.

I would suggest that you close up the program when you do this or it may fail when you try.

___

## Uninstall our first package

Just like installing programs, uninstalling programs can be quite the long process on Windows and here Chocolatey can automate the process for you again.

We're going to Uninstall Google Chrome from this machine.

-   To uninstall Google Chrome using Chocolatey we can use the below command

`choco uninstall googlechrome -y`

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Uninstall-01.png)

-   This will uninstall the package in most cases without you having to do anything else.

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Uninstall-02.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Uninstall-03.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Uninstall-04.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Uninstall-05.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Package-Uninstall-06.png)

>
There is a chance with some applications that the uninstall from here won't fully remove the files. For example, there still be there may be a Programs File Folder with your user data. If this happens you’ll be prompted to use the actual program's uninstall program. You may have to then manually delete those folders if needed for a full clean uninstallation.

Congratulations, we’ve now covered the basics of Chocolatey and you’ve managed one package but it’s time to start managing multiple packages at once.

___

## Install several packages at once (Google Chrome, Notepad++ and 7zip)

Installing one program at a time, using choco commands is quite useful but we can use those same commands to manage more than just one package.

We’ll be installing Google Chrome, Notepad++ and 7zip all in one go using just one line of code.

We’ve already seen how we can get the package names from the repository so we’re going to skip ahead to the install.

We can add as many of the package names after each other to chain the install command and add the -y switch at the end of it to press y throughout the installation to make it unattended.

-   Open up a new Windows PowerShell terminal and “Run as administrator”

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-00.png)

-   Run the below command to start the installation

`choco install googlechrome notepadplusplus 7zip -y`

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-01.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-02.png)

-   This will take 5 to 10 minutes and is definitely time to go and grab a coffee as Chocolatey gets to work on the download and install of the programs

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-03.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-04.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-05.png)

If we take a look on our Desktop we now have the Google Chrome shortcut and in our Start Menu as we normally would.

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-10.png)

-   We can also see 7zip has installed with shortcuts in the Start Menu

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-11.png)

-   Google Chrome is in the Start Menu

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-13.png)

-   Finally we can see that Notepad++ has also been installed as normal and can be found in the Start Menu aswell

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Install-14.png)

Congratulations, you just downloaded and installed 3 programs at once using just one line of code and Chocolatey. The best part was it did this unattended so you could do something else thanks to good old fashioned automation.

___

## Upgrade several packages at once (Google Chrome, Notepad++ and 7zip)

When you're working with more than one package and need to upgrade just a few you can use the same principle and name the packages you want to upgrade.

Use the below command to upgrade the packages we just installed only

`choco upgrade googlechrome notepadplusplus 7zip -y`

This will search out any upgrades and apply them if needed all at once.

___

## Uninstall several packages at once (Google Chrome, Notepad++ and 7zip)

Just like the Uninstall Choco command for one package you can uninstall as many packages as you want by adding the package names to the command.

>
Please Note: You may need to input some commands when using the uninstall choco command as not all of it can be automated. In those rare cases like in this example below you’ll have to wait to see if you’re prompted and follow the instructions in the terminal

-   Open a Powershell window using "Run as Administrator"
-   Run the below command

`choco uninstall googlechrome notepadplusplus 7zip -y`

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-03.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-04.png)

-   In this case, Notepad++ has another service called a metapackage that’s been installed to help run it.
-   Chocolatey will ask if we want to uninstall that Notepadplusplus.service too.
-   We only have 20 seconds for each answer before it fails so type **Y** and Press **Enter** twice to start the uninstallation of NotePad++ and continue.

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-05.png)

-   In this example, 7zip has a metapackage as well so we'll have to type **Y** and Press **Enter** twice to uninstall **7zip** and continue.

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-06.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-07.png)

-   Google Chrome can be uninstalled without any further intervention so will start to uninstall it's self now

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-08.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-09.png)

-   This should take about 5 minutes to fully complete and in this example you won't be prompted again but watch out for those packages that do.

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-10.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-11.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-12.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-13.png)

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-14.png)

-   We’ve now uninstalled all of the packages and we should have a list of the main packages not the metapackages we removed
-   If we go to our Start Menu all of our installed programs have now been removed

![](https://reprodev.com/content/images/2024/02/07-Choco-Multi-Package-Uninstall-15.png)

___

## Check current installed packages

We can check the packages currently installed by Chocolatey by using the below command

`choco install`

___

## Upgrade all packages

Use at your own risk and make sure you're not in the middle of something important if you decide to run the below command.

It'll upgrade every package you've currently got installed without any confirmation which can be useful but not the best way of doing this.

`choco upgrade all -y`

___

## Uninstall Chocolatey and All Packages

We’ve had a lot of fun playing around with Chocolatey and installing packages from the command line but what if you want to just to go back to the way it was.

Well, we can use the **choco uninstall** command to remove Chocolatey and most of the software it installed for us

>
Beware: Be absolutely sure you want to remove all the packages you’ve installed up till now. Once you’ve hit Enter after typing in this command you won’t be able to interrupt it without causing issues to some of the programs and your overall Windows installation.

`choco uninstall all`

>
You can use the -y switch if you are sure that you don’t want to be prompted per package. Remember that some packages will still require you to press Yes so you may want to stick around for this mass uninstall.

`choco uninstall all -y`

___

## What about Winget?

Winget was introduced as the package manager by Microsoft for Windows 10 upwards in 2021.

[Use the winget tool to install and manage applications](https://learn.microsoft.com/en-us/windows/package-manager/winget/)

It does what Chocolatey does but relies on the Microsoft Store for it’s repository of packages and programs.

As it uses the Microsoft Store, it currently has not as many packages to choose from as Chocolatey does. This does seem to be the future plan from

You’ll find that right now the package you want won’t be available using Winget but will be when using Chocolatey.

It's useful in it’s current state but needs a little time to mature and for more packages to be added to the Microsoft store.

When this happens, it will be a major competitor to the long standing dominance of Chocolatey in the Windows package management space.

For me though Chocolatey still wins out.

___

## Chocolatey for Automated Windows VM Configs

Overall, I’m a big fan of Chocolatey and using one line to automate the installation of my most useful apps makes my life much simpler for Windows Virtual machines especially.

We’re going to look at a few bigger use cases in a future guide when we look at using it as part of the automated setup and deployment of a Windows 11 Virtual Machine running on Esxi 8.0.

There's a lot more inspiration that you can find in the Chocolatey subreddit too

[https://www.reddit.com/r/chocolatey/](https://www.reddit.com/r/chocolatey/?ref=reprodev.com)

___

Congratulations for getting through this overview and guide to Chocolatey. It wasn't the shortest blog so well done for making it to the end.

I hope I've given you a few ideas of what you can do with this and how it might save you a lot of time on some of the boring system admin you have to do.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExOW5tMGs3OG5qemR1ZW45ZjZvbTQ5YTR6c3J2ZDllanB6Z2ZwbnhoNCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/Tyyr7XJh3NKco/giphy.gif">

___

Don't forget to explore the rest of our website as we build out more content. Stay tuned for more tutorials, tips, and tricks to help you make tech work for you.

If you want to stay up-to-date with regular updates, make sure to subscribe to our free mailing list.

___