Windows Server

Managing Windows Server with Puppet Part 6: Installing, Updating, and Removing Software

USB Type-C connector (Image Credit:

In today’s Ask the Admin, I’ll show you how to manage Puppet, Windows Installer, and Chocolatey.



Sponsored Content

Devolutions Remote Desktop Manager

Devolutions RDM centralizes all remote connections on a single platform that is securely shared between users and across the entire team. With support for hundreds of integrated technologies — including multiple protocols and VPNs — along with built-in enterprise-grade password management tools, global and granular-level access controls, and robust mobile apps to complement desktop clients.

So far in this series, I’ve looked at installing Puppet Master Enterprise in Azure and automatically bootstrapping the Puppet agent in a Windows Server VM. In parts four and five I showed you how to manage files and permissions and manage local users and groups. If you missed any of the previous articles, here’s a complete list of them so far:

Managing Windows Server with Puppet Part 1: Configure Puppet Master and Bootstrap the Puppet Agent in Windows Server

Managing Windows Server with Puppet Part 2: Log Into Puppet Master, Accept Node Certificate, and Test Connectivity

Managing Windows Server with Puppet Part 3: Install the Modules and Edit the Site Manifest

Managing Windows Server with Puppet Part 4: Working with Files and ACLs

Managing Windows Server with Puppet Part 5: Managing Local Users and Groups

Puppet Package Providers

There are two ways you can manage software using Puppet. The built-in package provider allows you to install software using executables (.exe files) and Windows Installer (.msi) packages. It’s possible to change the default provider and use Chocolatey, which is an open source package manager for Windows. The open source version of Chocolatey is free. Chocolatey for Business (C4B) must be licensed and it adds features for organizations that want a centralized software management solution, such as Package Builder. For more information on Chocolatey, see Package Management in Windows Using Chocolatey and Managing Windows Software Using Chocolatey on Petri.

Built-in Package Provider

Let’s look at how to install software using Puppet’s built-in package provider. To complete the instructions below, you’ll need an .exe or .msi file of the software you want to install. Here I’m using Git as an example. In the code below, I’m installing Git from a local file location on the node but you can also specify a network file share. Note that any install options you specify must be supported by the .exe or .msi installer package. They are not specific to Puppet.

package {'Git':
  ensure => installed,
  source => 'C:\temp\Git-2.16.2-64-bit.exe',
  install_options => ['/VERYSILENT']

If you want to install a specific version of a package, or the latest version, you must give the exact version number in the ensure parameter. The built-in package provider doesn’t support using latest as a value for the ensure parameter with .exe or .msi files on Windows.
package { 'Git':
  ensure => '2.16.2',
  source => 'C:\temp\Git-2.16.2-64-bit.exe',
  install_options => ['/VERYSILENT'],

Installing Software Using Chocolatey

The Chocolatey provider is installed as part of the Puppet on Windows module pack. Chocolatey can be used to install packages from Chocolatey’s own Internet repository or you can install software from your own local repository.

Installing software using Chocolatey and Puppet (Image Credit: Russell Smith)
Installing Software Using Chocolatey and Puppet (Image Credit: Russell Smith)

The code below uses ‘include chocolatey’ to install chocolatey on the node. And then it installs Git from Chocolatey’s Internet repository. When using the Chocolatey provider for Puppet, the value of the ensure parameter can be set to latest.

include chocolatey

package { 'git':
  ensure   => installed,
  provider => chocolatey,

Installing software using Chocolatey and Puppet (Image Credit: Russell Smith)
Installing Software Using Chocolatey and Puppet (Image Credit: Russell Smith)

If you want to install a package from something other than Chocolatey’s own Internet repository, you need to specify the repo using the source parameter. In the example below, I’m using a local file share as my repository. Note that there are three backslashes at the start of the file path to represent two literal backslashes in Windows.

package {'GoogleChrome':
  ensure => installed, 
  source => '\\\filesrv1\soft'

When installing software from a local repository, make sure that any dependent packages are also present in the repository. Google Chrome doesn’t have any dependencies. Other packages, like Git, have one or more dependencies. There are a couple of ways to determine a package’s dependencies. The easiest is to go to the package in Chocolatey’s Internet repository, scroll down, and see the list of dependencies. Alternatively, you can open a package using NuGet Package Explorer to view dependencies.

Removing Software

Uninstalling software is very easy. Whether you are using Chocolatey or Puppet’s built-in provider, you just set the value of ensure to absent.

package {'GoogleChrome':
  ensure => absent, 

In this article, I showed you how to install software using Puppet’s built-in package provider and using Chocolatey.

Related Topics:


Don't have a login but want to join the conversation? Sign up for a Petri Account

Comments (0)

Leave a Reply

IT consultant, Contributing Editor @PetriFeed, and trainer @Pluralsight. All about Microsoft, Office 365, Azure, and Windows Server.