June 4, 2020

Puppet Facts for Windows

Products & Services

To manage your Windows desktops and servers based on the version / edition of Windows installed across your organization, use Windows build-specific Puppet facts.

Table of Contents

What are Puppet Facts?

Facter is Puppet’s system profiling tool, which uses a set of Ruby libraries to run cross-platform on clients’ returning stateful information about the client called Facts. These facts contain information, such as the version of which operating system is installed or the IP address assigned to a Network interface. This is then exposed as variables to Puppet code, allowing configuration decisions to be made for a client.

Puppet Facts for Windows

If you have a mix of Windows servers (Core and ServerStandard) and Windows desktops with varying versions and editions of Windows, using Windows build-specific Puppet facts allows you to:

  • Avoid installing GUI type tools (Notepad++) on Windows core servers
  • Ensure that new features (e.g. Windows Terminal) are only installed on versions of Windows that support them
  • Install VS Code with Puppet extensions on client desktops only

Related: Check out this podcast episode on the Puppet VS Code extension >>

Let’s see what all this looks like in some Puppet code:

 if $facts['os']['windows']['release_id'] >= '1904' {
    # Ensure Build Version Supports Windows Terminal
    package { 'microsoft-windows-terminal':
      ensure   =>  installed,
      provider => 'chocolatey',

  if $facts['os']['windows']['installation_type'] != 'Server Core' {
    # Editors not permitted on Core Servers
    package { 'notepadplusplus':
      ensure   =>  installed,
      provider => 'chocolatey',

  if $facts['os']['windows']['installation_type'] == 'Client' {
    # VS Code to be installed on Desktops with Puppet Extensions
    package { 'vscode':
      ensure   =>  installed,
      provider => 'chocolatey',
    package { 'vscode-puppet':
      ensure   =>  installed,
      provider => 'chocolatey',


What are the Windows Puppet Facts? What Do They Do?

The previous example uses a number of facts under the os.windows key:

C:> facter os.windows
  Display_version => "22H2"  

  edition_id => "Professional",
  installation_type => "Client",
  product_name => "Windows 10 Pro",
  release_id => "22H2",
  system32 => "C:\WINDOWS\system32"


All of these facts are derived from the Windows Registry Key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion as shown in the following table.

Registry Value






Version codename mixed string




The 4 digit Windows Build Version

YYMM (e.g. 1904) until deprecation in 21H1 now YYHM



Differentiates Server, Server Core, and Client (Desktop)




Server or Desktop Edition variant

ServerStandard, Professional, Enterprise



Textual Product Name

Windows 2022 Standard Edition

Note - There are some inconsistencies across Windows versions due to changes anddeprecationsof the underlying registry entry. ReleaseID was deprecated in 21H1 and Display Version added, although for 21H1 the release version remains 2009. It changes to mirroring display version after that point. Server 2012 doesn’t have ReleaseID as it wasn’t added until 1803. The registry entry also lists the product name for Windows 11 as Windows 10 and this major version should be sourced from os.release.major instead.

These facts also support:

  • Fact Collection to determine Windows 10 Build Versions (Feature releases)
  • Patching and ensuring supported versions are in use

The os facts are documented at Core Facts and this can be expanded on creating your own Windows custom facts following the Starting out writing custom facts for Windows guide. The facterdb project contains sample facts for various versions of Windows and other operating systems.

Puppet on Windows

If you're looking for more information about Puppet on Windows, check out the Top Questions and Answers for Puppet on Windows and the Windows collection on the Puppet forge, which brings together articles, how-to guides, and the most popular Windows modules. The Puppet Forge also contains content from the PowerShell gallery, allowing Windows users to automate the deployment of PowerShell DSC (Desired State Configuration) content wrapped in Puppet modules.

Learn More

John O’Connor was a senior engineer in developer services who has a passion for ensuring Windows remains a first-class Puppet citizen.

This post was originally published on June 4, 20202, and has been updated for accuracy.