BreadcrumbHomeResourcesBlog Puppet Facts For Windows: What They Are, What They Do + Ways To Utilize Them June 4, 2020 Puppet Facts for Windows: What They Are, What They Do + Ways to Utilize ThemWindowsProducts & 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?What are Windows Puppet Facts? What Do They Do?Examples of Puppet Facts for WindowsDo More with Puppet on WindowsTable of Contents1 - What are Puppet Facts?2 - What are Windows Puppet Facts? What Do They Do?3 - Examples of Puppet Facts for Windows4 - Do More with Puppet on WindowsBack to topWhat are Puppet Facts?In Puppet, Facts are pieces of information on the state of a client. Puppet Facts facts contain client information like OS and network interface IP address. Puppet Facts are used to manage configurations for the client.Puppet Facts come from Facter, Puppet’s system profiling tool, which uses a set of Ruby libraries to run across platforms.Back to topWhat are Windows Puppet Facts? What Do They Do?If you have a mix of Windows servers (Core and ServerStandard) and Windows desktops with varying versions and editions of Windows, using Windows 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 onlySet Yourself Apart with Deeper Puppet SkillsFree on-demand courses let you build your skillset faster and get ready for certification.PUPPET TRAININGBack to topExamples of Puppet Facts for WindowsLet’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', } } 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 and deprecations of 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.Back to topDo More with 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.The Puppet Forge also contains content from the PowerShell gallery, allowing Windows users to automate the deployment of PowerShell DSC 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 restartUse 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.Back to top