---
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/

---

- Automate PowerShell Modules with Chocolatey Packages Tap to hide Home

- Tutorials

- Guidebooks

- Instructors

- Get Paid to Write

- Advertising

- Recommended Resources

- About Adam

                Search for:

-

-

-

-

# Automate PowerShell Modules with Chocolatey Packages

        Published:1 August 2019 - 2 min. read

- Chocolatey
- PowerShell

          [](https://adamtheautomator.com/author/adam-bertram/)

            [Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)

            Read [more tutorials](https://adamtheautomator.com/author/adam-bertram/) by Adam Bertram!

-

-

        [](https://specopssoft.com/product/specops-password-auditor/?utm_source=adamtheautomator&utm_medium=referral&utm_campaign=adamtheautomator_referral_na&utm_content=display)
        Audit Active Directory for stale users, weak passwords, and other security risks with [Specops Password Auditor](https://specopssoft.com/product/specops-password-auditor/?utm_source=adamtheautomator&utm_medium=referral&utm_campaign=adamtheautomator_referral_na&utm_content=text).

Table of Contents

- Installing Chocolatey
- Creating an NUSPEC file
- How to Create Chocolatey Package
- Summary

                XFacebookLinkedIn

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:

> 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:

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/) 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/) 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:

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 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.

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.

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

Learning How to Create Chocolatey Package

  Hate ads? Want to support the writer? Get many of our tutorials packaged as an ATA Guidebook.

  [Explore ATA Guidebooks](https://adamtheautomator.com/ata-guidebooks/)

## More from ATA Learning and Partners

- ### Recommended Resources! Recommended Resources for Training, Information Security, Automation, and more!

- ### Get Paid to Write! ATA Learning is always seeking instructors of all experience levels. Regardless if you’re a junior admin or system architect, you have something to share. Why not write on a platform with an existing audience and share your knowledge with the world?

- ### ATA Learning Guidebooks ATA Learning is known for its high-quality written tutorials in the form of blog posts. Support ATA Learning with ATA Guidebook PDF eBooks available offline and with no ads!

## Categories

- IT Ops

- Cloud

- DevOps

- Home Ops

- Information Security

- Software Development

## Site

- Home

- Tutorials

- Guidebooks

- Instructors

- Get Paid to Write

- Advertising

- Recommended Resources

- About Adam

        Copyright 2026&copy; ATA Learning | [Privacy Policy](https://adamtheautomator.com/privacy/)

                                                        Don't be left behind with the ATA Learning Newsletter!

Looks like you're offline!
