BreadcrumbHomeResourcesBlog Puppet Facts For Windows June 4, 2020 Puppet Facts for WindowsWindowsProducts & ServicesBy John O'ConnorTo 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 ContentsWhat are Puppet Facts? Puppet Facts for WindowsWhat Do Puppet Facts Do?Puppet on WindowsWhat 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 WindowsIf 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 serversEnsure that new features (e.g. Windows Terminal) are only installed on versions of Windows that support themInstall VS Code with Puppet extensions on client desktops onlyRelated: 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 ValueFactDescriptionSyntax/ExampleDisplayVersiondisplay_versionVersion codename mixed string22H2ReleaseIDrelease_idThe 4 digit Windows Build VersionYYMM (e.g. 1904) until deprecation in 21H1 now YYHMInstallationTypeinstallation_typeDifferentiates Server, Server Core, and Client (Desktop)ServerEditionIDedition_idServer or Desktop Edition variantServerStandard, Professional, EnterpriseProductNameproduct_nameTextual Product NameWindows 2022 Standard EditionNote - 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 useThe 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 WindowsIf 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 MoreHow to make custom Puppet features to confine custom factsDatadog + Puppet: Sending facts as tags for metrics and eventsHow to solve critical Windows services restartWatch the webinar: 5 Simple Ways to Manage Endpoints with Puppet EnterpriseUse the Puppet Directory Guide to help you navigate all of Puppet's directoriesHow a Puppet and Microsoft Windows integration helps with infrastructure automationJohn 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.