Chocolatey is a software deployment solution and package manager for Windows PowerShell that allows you to automate software management in your network.

In Windows, one of the tasks admins most wish to automate is deploying software. Due to agile software development practices, a new version of any given software can come out much more frequently than it did even a few years ago. This ultimately means that to deploy the new version to your computers, you need to be on top of these releases, making packages out of them and installing them to your servers and workstations. This can be a very painstaking task.

Fortunately, Chocolatey is a great solution for automating these tasks for Windows IT professionals, with either its open-source or business (C4B) versions. In this article, I will be using Chocolatey for Business (C4B) in my demonstrations.

Installing the Chocolatey client

For installing the Chocolatey client from the community repository, we can simply run one line of PowerShell:

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString(''))

This downloads and runs a PowerShell script that installs Chocolatey into C:\ProgramData\Chocolatey. Very simple! However, if you are installing in an enterprise environment, you will want to install the client from your own internal NuGet repository. You can do this by internalizing the Chocolatey package, which I will show later in the article. For other methods of installing the Chocolatey client, look here.

Installing a Chocolatey package

Now that we've installed our Chocolatey client, let's actually install a package. One of Chocolatey's great features is the ability to install from multiple sources. That could be the community repository or an internal repository you create.

Here I will install Notepad++:

choco install notepadplusplus -y
Installing Notepad++

Installing Notepad++

One recently added feature of C4B is the ability to have non-admin end users install software via the Chocolatey GUI. This is a great self-service option for businesses wanting to offload requests for installing software.

Chocolatey GUI self service

Chocolatey GUI self service

Creating a Chocolatey package

With C4B, users have the ability to create packages via command-line interface (CLI) or by a package builder GUI (see below). I much prefer the CLI method because it allows you to create a fully unattended software deployment in five seconds with one command: choco new. In this example, I create a package from a Git installer I downloaded.

PS C:\Example> Get-ChildItem

    Directory: C:\Example

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        1/29/2018  10:42 AM       39984304 Git-2.16.1-64-bit.exe
Creating a Git package

Creating a Git package

One additional parameter --build-package is necessary to complete the creation of the package. Without this, you will just have files and data needed to run choco pack, which will actually create the .nupkg file.

Below is a screenshot of using the package builder GUI by right-clicking on an installer and choosing it from an Explorer menu:

Package Builder GUI

Package Builder GUI

Internalizing software from the Chocolatey community repository

One of my main gripes when I first started using Chocolatey is the developers discourage installing from the community repository in a business setting. Check out the reasoning here.

This is where the business version comes in handy. Using the choco download command, we can download a community package that will also download any remote installers and resources and bake them into our own internal package. You can then push it to your own repository for safer use.

Think of the amount of time you can save now knowing you do not have to re-invent the wheel and can deploy new versions quickly. With some PowerShell, you do not even have to do anything manually.

Here I download and internalize Google Chrome from the community repository:

Internalizing Google Chrome

Internalizing Google Chrome

As you can see, Chocolatey downloads the remote resources from and replaces those references in your internal package so that it points to these instead of downloading them at runtime.

Now I push my Google Chrome package to my own internal repository choco-1:

choco push .\GoogleChrome.64.0.3282.11900.nupkg --source=https://choco-1:8080/chocolatey --api-key='chocolateyrocks'
Chocolatey v0.10.8 Business
Attempting to push GoogleChrome.64.0.3282.11900.nupkgto https://choco-1:8080/chocolatey
GoogleChrome 64.0.3282.11900 was pushed successfully to https://choco-1:8080/chocolatey

Just like that, I can now deploy Google Chrome to my Chocolatey clients safely and securely.

Additional features

While I have illustrated the most popular features of using Chocolatey, there are many others. Some features include but are not limited to:

Subscribe to 4sysops newsletter!

  • Runtime malware protection with VirusTotal or your own anti-virus software
  • Overriding install directories with one ubiquitous switch
  • Package templates
  • Ability to use a content delivery network (CDN) cache
  • Package auditing
  • Ability to create PowerShell extensions (functions)


With automation continuing to be crucial for sysadmins and engineers, no other Windows software manager delivers quite like Chocolatey. With Chocolatey you have the capability to reduce the overhead in creating, installing, and deploying both third-party and internal software. In addition, Chocolatey is an independent software deployment tool usable by itself or with popular infrastructure management tools. These include System Center Configuration Manager (SCCM), Puppet, Chef, and Ansible, which Chocolatey has modules for.

  1. Steve 5 years ago

    Great article, did you do one on how to create an internal repository?

  2. Artur Tyksinski 4 years ago

    Didn't even know you could integrate the two in such an awesome way.

Leave a reply to Swapnil Kambli (Rank 3) Click here to cancel the reply

Please enclose code in pre tags

Your email address will not be published.


© 4sysops 2006 - 2023


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account