Puppet Enterprise 2017.3

Check for the following issues if manifests cannot be applied or are not applied correctly on Windows nodes.

Path or file separators are incorrect

For Windows, path separators must use a semi-colon (;), while file separators must use forward or backslashes as appropriate to the attribute.

In most resource attributes, the Puppet language accepts either forward or backslashes as the file separator. However, some attributes absolutely require forward slashes, and some attributes absolutely require backslashes.

When backslashes are double-quoted("), they must be escaped. When single-quoted ('), they may be escaped. For example, these are valid file resources:

file { 'c:\path\to\file.txt': }
file { 'c:\\path\\to\\file.txt': }
file { "c:\\path\\to\\file.txt": }

But this is an invalid path, because \p, \t, and \f are interpreted as escape sequences:

file { "c:\path\to\file.txt": }

For more information, see the language reference about backslashes on Windows.

Cases are inconsistent

Several resources are case-insensitive on Windows, like files, users, groups. However, these resources can be case sensitive in Puppet.

When establishing dependencies among resources, make sure to specify the case consistently. Otherwise, Puppet can't resolve dependencies correctly. For example, applying this manifest fails, because Puppet doesn't recognize that ALEX and alex are the same user:

file { 'c:\foo\bar':
  ensure => directory,
  owner  => 'ALEX'
user { 'alex':
  ensure => present
err: /Stage[main]//File[c:\foo\bar]: Could not evaluate: Could not find user ALEX

Shell built-ins are not executed

Puppet doesn't support a shell provider on Windows, so executing shell built-ins directly fails.

Wrap the built-in in cmd.exe:

exec { 'cmd.exe /c echo foo':
  path => 'c:\windows\system32;c:\windows'

Tip: In the 32-bit versions of Puppet, you might encounter file system redirection, where system32 is switched to sysWOW64 automatically.

Powershell scripts are not executed

By default, Powershell enforces a restricted execution policy which prevents the execution of scripts.

Specify the appropriate execution policy in the Powershell command, for example:

exec { 'test':
  command => 'powershell.exe -executionpolicy remotesigned -file C:\test.ps1',
  path    => $::path

Or use the Puppet supported PowerShell module.

Services are referenced with display names instead of short names

Windows services support a short name and a display name, but Puppet uses only short names.

  1. Verify that your Puppet manifests use short names, for example wuauserv, not Automatic Updates.
Back to top