September 20, 2020

How to Use Modules from the PowerShell Gallery with Puppet

Infrastructure Automation
Windows

You know and love PowerShell DSC, which means you probably use PowerShell Gallery to find new scripts, modules, and resources to use with it. But did you know that you can install PowerShell modules using Puppet – and then use them just like a Puppet module? Read on to find out how to get the best of PowerShell Gallery, right from your Puppet Enterprise console.

Table of Contents

What is the PowerShell Gallery? 

PowerShell Gallery is the central repository for PowerShell modules and scripts, including PowerShell DSC. PowerShell Gallery makes it so you don't have to create new scripts every time you want to use PowerShell for something new.

Microsoft launched the PowerShell Gallery in 2015 as a central repository for PowerShell modules, scripts, and Desired State Configuration (DSC) resources. Over time, it's expanded with package management integrations, security updates, and community support. Devs and sysadmins publish PowerShell modules and scripts to the PowerShell Gallery, where other users can download and install them for use in their own PowerShell DSC.

Learn more about the benefits of using PowerShell for automation >>

Why You Should Be Using PowerShell Gallery

PowerShell Gallery is great because it makes PowerShell DSC more versatile and easier to use. You can find, share, vet, version, install, and update new PowerShell modules created and supported by the PowerShell community – all from one place.

PowerShell DSC resources offer unprecedented hooks into the Windows operating system and provide straightforward configuration functionality that will make your Unix coworkers green with envy.

The best part? You can use PowerShell Gallery with Puppet Enterprise to make DSC resources even easier to find and use for Windows automation.

How to Get PowerShell Modules with Puppet

You can now puppet module install any PowerShell Module with DSC Resources from the PowerShell Gallery and then simply use it just like you would any other Puppet module.

There's no need to set up a pull server, and no need to distribute the DSC Resources. Just classify your Windows nodes just like any other in your infrastructure. Write a profile class or use the Puppet Enterprise Console directly. And when you inspect the run reports later, you'll see each parameter that's changed and what values it changed.

Puppet can take an existing PowerShell Module and build a Puppet module out of it. Basically, it makes it so you can use PowerShell Modules exactly like you use Puppet modules.

It will package up all of its DSC resources and then wrap the Puppet Resource API around it so you can invoke it just like any other module. This means you no longer need to be concerned with the under-the-hood implementation details. You don't need to care which tools were invoked to effect a change. Just describe what you need in Puppet's effortlessly declarative language and then let Puppet do what it does best: abstract away the details and just make the changes you need.

For more on using Puppet to install modules from the PowerShell Gallery, head to the Forge. There, you can filter by your OS and Puppet version to find the right ones for your use case.

Click here to browse DSC modules on the Puppet Forge >>

Have you developed your own DSC resource? You can package it into a Puppet module using the Puppet Development Kit (PDK) and by following these instructions.

Best of all, when paired with Puppet's VS Code extension, you'll get all the IntelliSense goodness that you've come to expect as you're writing your profile classes. Not only do you get context-sensitive syntax highlighting and autocompletion, but you'll get parameter validation that knows what data types to use and even which values are acceptable – even if that comes from the wrapped DSC resource!

Other Great Puppet Services

Of course we don't expect you to adopt new automation tools completely on your own. Check out these other resources.

  • Group Policy Migration Service: Learn best practices of managing settings between Group Policy and Puppet, track Windows configurations in a centralized location, and consolidate tooling to make changes to Windows infrastructure more efficiently.
  • Chocolatey Setup & Deployment Service: Accelerate the speed of your Windows deployments and support the expansion of automation across your organization. Through installing and configuring Chocolatey as a package manager you can deploy and make changes to Windows software at scale, quickly, and more reliably. Learn more about package management using Chocolatey and Windows.

Check out Puppet and say goodbye to the tedium of manual work as your IT Ops and InfoSec teams configure and harden your Windows infrastructure. Not using Puppet Enterprise yet? Get started today!

START PUPPET TRIAL

Learn More