Running Puppet commands on Windows

Puppet was originally designed to run on *nix systems, so its commands generally act the way *nix admins expect. Because Windows systems work differently, there are a few extra things to keep in mind when using Puppet commands.

Supported commands

Not all Puppet commands work on Windows. Notably, Windows nodes can’t run the puppet server or puppetserver ca commands.

Running Puppet's commands

The installer adds Puppet commands to the PATH. After installing, you can run them from any command prompt (cmd.exe) or PowerShell prompt.

Open a new command prompt after installing. Any processes that were already running before you ran the installer do not pick up the changed PATH value.

Running with administrator privileges

You usually want to run Puppet’s commands with administrator privileges.

Puppet has two privilege modes:
  • Run with limited privileges, only manage certain resource types, and use a user-specific confdir and codedir

  • Run with administrator privileges, manage the whole system, and use the system confdir and codedir

On *nix systems, Puppet defaults to running with limited privileges, when not run by root, but can have its privileges raised with the standard sudo command.

Windows systems don’t use sudo, so escalating privileges works differently.

Newer versions of Windows manage security with User Account Control (UAC), which was added in Windows 2008 and Windows Vista. With UAC, most programs run by administrators still have limited privileges. To get administrator privileges, the process has to request those privileges when it starts.

To run Puppet's commands in adminstrator mode, you must first start a Powershell command prompt with administrator privileges.

Right-click the Start (or apps screen tile) -> Run as administrator:

Click Yes to allow the command prompt to run with elevated privaleges:

The title bar on the comand prompt window begins with Administrator. This means Puppet commands that run from that window can manage the whole system.

The Puppet Start menu items

Puppet’s installer adds a folder of shortcut items to the Start Menu.



These items aren’t necessary for working with Puppet, because Puppet agent runs a normal Windows service and the Puppet commands work from any command or PowerShell prompt. They’re provided solely as conveniences.

The Start menu items do the following:
Run Facter
This shortcut requests UAC elevation and, using the CLI, runs Facter with administrator privileges.
Run Puppet agent
This shortcut requests UAC elevation and, using the CLI, performs a single Puppet agent command with administrator privileges.
Start Command Prompt with Puppet
This shortcut starts a normal command prompt with the working directory set to Puppet's program directory. The CLI window icon is also set to the Puppet logo. This shortcut was particularly useful in previous versions of Puppet, before Puppet's commands were added to the PATH at installation time.
Note: This shortcut does not automatically request UAC elevation; just like with a normal command prompt, you'll need to right-click the icon and choose Run as administrator.

Configuration settings

Configuration settings can be viewed and modified using the CLI.

To get configuration settings, run: puppet agent --configprint <SETTING>

To set configuration settings, run: puppet config set <SETTING VALUE> --section <SECTION>

When running Puppet commands on Windows, note the following:

  • The location of puppet.conf depends on whether the process is running as an administrator or not.

  • Specifying file owner, group, or mode for file-based settings is not supported on Windows.

  • The puppet.conf configuration file supports Windows-style CRLF line endings as well as *nix-style LF line endings. It does not support Byte Order Mark (BOM). The file encoding must either be UTF-8 or the current Windows encoding, for example, Windows-1252 code page.

  • Common configuration settings are certname, server, and runinterval.

  • You must restart the Puppet agent service after making any changes to Puppet’s runinterval config file setting.