Ask Your Question

Puppet Windows not recognize third party executable file located in C:\Windows\System32

asked 2013-11-06 00:19:45 -0500

dalang gravatar image

updated 2013-12-16 03:04:25 -0500

I need use curl.exe in my case. So I copy curl.exe to C:\Windows\System32. Then I can use curl like system command in cmd.exe

But when I run the following code:

  exec { "curl an url":
    command => 'cmd.exe /c "curl.exe http://url.domain"',
    path    => "C:\\Windows\\System32",
    returns => 0,

puppet will return

curl.exe is not recognized as an internal or external command

and of course, windows did not do a curl action.

But if I locate curl.exe at other path rather than "C:\Windows\System32", like "C:\". The curl.exe works well!

Here ... (more)

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-11-08 14:26:51 -0500

updated 2013-11-08 14:27:35 -0500

Path is used for the command not the arguments, IIRC:

exec { "curl an url":
  command => 'cmd.exe /c "c:\\windows\\sysnative\\curl.exe http://url.domain"',
  path    => "C:\\Windows\\System32",
  returns => 0,

It might technically work without the path being declared, but note the use of sysnative. When puppet runs, it runs in 32-bit mode, so it may not find curl due to windows automatically remapping c:\windows\system32 to c:\windows\syswow64. SysNative allows you to force it to the actual System32 directory.

Take a look at ... (more)

edit flag offensive delete link more



The `cmd.exe /c <file>` trick is only necessary when executing batch files, so you should be able to execute `curl.exe` directly. The problem is mostly filesystem redirection as Rob describes.

joshc gravatar imagejoshc ( 2013-11-11 13:07:15 -0500 )edit

You are definitely right. Prepending c:\\windows\\sysnative\\ to curl.exe makes it work well. And as you said, it really use `c:\windows\syswow64` in searching curl. When I ...(more)

dalang gravatar imagedalang ( 2013-12-16 03:03:46 -0500 )edit

In addition, if I remove path directly, it will raise a error for no path was specified and ask me to qualify the command or specify a path.

dalang gravatar imagedalang ( 2013-12-16 03:20:16 -0500 )edit

you could use path => "C:\\Windows\\System32:c:\\windows\\sysnative\\", or path => ["C:\\Windows\\System32", "c:\\windows\\sysnative\\"] , and I believe it will try both, 32 bit then 64 bit.

Christopher_G_Lewis gravatar imageChristopher_G_Lewis ( 2014-01-03 14:58:13 -0500 )edit

answered 2013-11-06 15:52:26 -0500

GregLarkin gravatar image

Try changing your double backslashes in the path attribute to single backslashes. Does that solve the problem?

edit flag offensive delete link more


It can't solve the problem. Even I tried with path => "C:\Windows\System32" or path => 'C:\Windows\System32'.

dalang gravatar imagedalang ( 2013-12-16 02:56:16 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-11-06 00:19:45 -0500

Seen: 1,075 times

Last updated: Dec 16 '13