Issue #21656 has been updated by Lee Lowder. Status changed from Unreviewed to Closed
This is not a bug, but is documented behavior. http://docs.puppetlabs.com/references/3.2.latest/type.html#exec Execute external binaries on Windows systems. As with the `posix` provider, this provider directly calls the command with the arguments given, without passing it through a shell or performing any interpolation. To use shell built-ins --- that is, to emulate the `shell` provider on Windows --- a command must explicitly invoke the shell: exec {'echo foo': command => 'cmd.exe /c echo "foo"', } If no extension is specified for a command, Windows will use the `PATHEXT`environment variable to locate the executable. **Note on PowerShell scripts:** PowerShell's default `restricted` execution policy doesn't allow it to run saved scripts. To run PowerShell scripts, specify the `remotesigned` execution policy as part of the command: exec { 'test': path => 'C:/Windows/System32/WindowsPowerShell/v1.0', command => 'powershell -executionpolicy remotesigned -file C:/test.ps1', } ---------------------------------------- Bug #21656: Pipe command in windows https://projects.puppetlabs.com/issues/21656#change-94681 * Author: Jacob Struiksma * Status: Closed * Priority: Normal * Assignee: * Category: * Target version: * Affected Puppet version: 3.2.1 * Keywords: * Branch: ---------------------------------------- The pipe command in the windows version of puppet doesn't seem to work properly. for example: exec { "test": command => "ping.exe |findstr count ", path => "c:/windows/system32", } would give me: Notice: /Stage[main]//Exec[test]/returns: Ping request could not find host |find str. Please check the name and try again. Error: ping.exe |findstr count returned 1 instead of one of [0] Error: /Stage[main]//Exec[test]/returns: change from notrun to 0 failed: ping.ex e |findstr count returned 1 instead of one of [0] workaround: use cmd /C before the command you would run, like this: exec { "test": command => "cmd /C ping.exe |findstr count ", path => "c:/windows/system32", } -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
