Puppet agent on Windows unless doesn't work how I think?

Solution 1:

To use commands with pipe |, you must use the shell builtins work around with cmd.exe /C:

See the example below:

exec { 'configure_timezone':
  command => "tzutil.exe /s \"${timezone}\"",
  unless  => "cmd.exe /C tzutil.exe /g | findstr /C:\"${timezone}\"",
}