---
title: "Automate PowerShell Modules with Chocolatey Packages"
description: "Create Chocolatey packages to automate PowerShell modules and software installations."
canonical: "https://adamtheautomator.com/create-chocolatey-package/"
---

# Automate PowerShell Modules with Chocolatey Packages

> Create Chocolatey packages to automate PowerShell modules and software installations.

Source: https://adamtheautomator.com/create-chocolatey-package/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Automate PowerShell Modules with Chocolatey Packages](https://adamtheautomator.com/wp-content/uploads/2019/08/chocolatey.png)

# Automate PowerShell Modules with Chocolatey Packages

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)1 August 20192 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Chocolatey](/tag/chocolatey/)[PowerShell](/tag/powershell/)

Table of Contents

*   [Installing Chocolatey](#installing-chocolatey)
*   [Creating an NUSPEC file](#creating-an-nuspec-file)
*   [How to Create Chocolatey Package](#creating-the-chocolatey-package)
*   [Summary](#summary)

In this blog post, learn how to create Chocolatey package (a popular Windows packaging manager).

As automation becomes more of necessity rather than a nicety, it’s important we IT folk look at better ways to perform menial tasks; one of those tasks is installing software. Rather than download an MSI, double-click on it and run through the wizard, it would behoove you to think of a better way.

Not a reader? Watch this related video tutorial!

**_Not seeing the video? Make sure your ad blocker is disabled._**

Nearly all software has command-line switches to install silently, and if you perform enough research, you might figure out the right switches. Your install might then look like this:

```bash
> install.exe /q /n /e /noreboot
```

Are you going to remember all of those switches? Probably not. You could put these switches in a batch file and then forget where you put that script _or_ you could do this:

```powershell
Install-Package -Name AcmeSoftware
```

Now _that’s_ something that can be remembered easily.

But how would you get to that point? The answer is a [NuGet](https://adamtheautomator.com/nuget-package-manager/ "NuGet") repository and a NuGet package. [NuGet](https://www.nuget.org) is a traditional software packing technology that allows you to essentially wrap up a piece of software which can then be stored in a repository, downloaded and installed at will. Chocolatey is a favorite open source tool that uses [NuGet](https://adamtheautomator.com/nuget-package-manager/) to allow IT administrators to download and silently install software.

In this article, I’m going to assume you’ve already got a NuGet repository setup or you know where you’re going to send your package.

Let’s take a piece of software and wrap it up in a NuGet package for use in one of these repositories.

## Installing Chocolatey

Since [Chocolatey](https://adamtheautomator.com/install-chocolatey/ "Chocolatey") is not installed by default on a Windows operating system, it must be downloaded and installed. It can be downloaded and installed by running this in a PowerShell console:

```powershell
PS> iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
```

## Creating an NUSPEC file

To create a Chocolatey package, you first must create an NUSPEC file. An NUSPEC file is an XML package manifest that describes the package contents. This NUSPEC file must be in a particular format. Here’s a sample NUSPEC file using only the required elements:

```xml
<?xml version="1.0" encoding="utf-8"?>
    <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
      <metadata>
        <id>MySpecialSoftware</id>
        <version>1.0</version>
        <description>Some software I'm packaging up.</description>
        <authors>Adam Bertram</authors>
      </metadata>
    </package>
```

For the complete rundown of all the tags that can be used refer to the [NUSPEC reference](https://docs.microsoft.com/en-us/nuget/reference/nuspec).

## How to Create Chocolatey Package

Next, create the package. To do this, we use the `Install-ChocolateyInstallPackage` command. Let’s pretend that the software we’re packaging up is an EXE and the switches to install it silently are `/s`. We must send the file location along with the silent switches to use to the command.

```powershell
PS> Install-ChocolateyPackage -PackageName 'AcmeSoftware' -FileType 'exe' -File 'C:\install.exe' -SilentArgs '/s'
```

This command will create the package. Next, we’ll need to pack the package using the `choco` exe.

```powershell
PS> choco pack
```

Once the software has been packaged up, it’s now in a format to where you can publish to a Chocolatey repository of your choice.

## Summary

This process can be repeated for each piece of software you need to deploy via Chocolatey. As you can see, there are only a few additional steps that must take place to get the software “Chocolatey-ready.” By doing so now allows you to get back to doing tasks that matter rather than figuring out how to deploy software to a bunch of machines at once!

If you’d like a deep dive more after you learned how to create Chocolatey packages, be sure to check out the [Chocolatey docs](https://docs.chocolatey.org/en-us/create/create-packages).

![](https://adamtheautomator.com/wp-content/uploads/2022/03/facebook-share-1024x538.png)

Learning How to Create Chocolatey Package

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fcreate-chocolatey-package%2F&text=Automate%20PowerShell%20Modules%20with%20Chocolatey%20Packages)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fcreate-chocolatey-package%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fcreate-chocolatey-package%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2019/12/chocolatey.jpeg)

### [Chocolatey Installation: A Step-by-Step Guide](/install-chocolatey/)

Install Chocolatey and master the basics of this powerful Windows package manager. Simplify software management and boost your IT efficiency.

![](https://adamtheautomator.com/wp-content/uploads/publisher/3ec5d9c85b2b8183bec6e5cc0f0356c5/a323a4d03629188de1d5ed18ca60a64a65f94bef73d5390488bde5511859fa05.webp)

### [AZ-800 vs. AZ-802: Avoid the Wrong Windows Server Exam](/az-800-vs-az-802/)

See what the AZ-800 retirement means for your Windows Server certification path and how to re-weight your study plan around the current AZ-802 exam.

![](https://adamtheautomator.com/wp-content/uploads/publisher/3ec5d9c85b2b811089d5d31807a89aa3/4f6fca0bf1e9083ef5217f16ceed8f939aa4f322e0b4be8d8e3dbb7be8ca3114.webp)

### [Automate Windows 11 Context Menu Actions with Registry](/automate-windows-11-context-menu-registry/)

Add custom right-click actions to Windows 11 context menus by editing registry verbs, deploying .reg files, and scripting with PowerShell.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
