Ask Your Question
0

Error 193: CreateProcess is not a valid Win32 application

asked 2015-10-05 11:45:27 -0500

michaelokoluko gravatar image

updated 2015-10-05 11:47:06 -0500

When I unziping a dowloded zip file I get the following;

"%1 is not a valid Win32 application. - CreateProcess is not a valid Win32 application"

Below is a snippet of the code showing the -> file { 'C:\puppetfolder\server.zip':

ensure   => 'file',
source   => 'puppet:///modules/downloadscript/server.zip',
checksum => 'mtime',
mode     => '0775',
owner    => 'Administrator',
group    => 'Administrator',

} -> exec {'unzip_c:\puppetfolder\server.zip':

path         => 'c:\\puppetfolder\\unzip.exe',    
command      => "C:\puppetfolder\unzip.exe /c C:\puppetfolder\server.zip C:\puppetfolder -y",   
logoutput    =>  true, 
provider     =>  'windows',

} ->

I'm using a 64 bit puppet version on windows 2012 which suppoerts or rather should use the redirect functionality to sysnative...sysWOW64.... Any pointers of what I need to do to fix this anomaly? Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-10-14 02:22:59 -0500

joshc gravatar image

Not sure if this is the issue, but the exec resource's quoting is not correct. The general rule is if you're doing string interpolation, then you must use a double-quoted string, and as a result, backslashes must be escaped.

If you don't need to do string interpolation, then use a single-quoted string, and while backslashes can be escaped, it's better not to.

Since you're not doing string interpolation, I'd just do:

path    => 'C:\puppetfolder\unzip.exe'
command => 'C:\puppetfolder\unzip.exe /c C:\puppetfolder\server.zip C:\puppetfolder -y',

If you were doing string interpolation, then you'd need to do something like:

command => "${puppetdir}\\unzip.exe /c ${puppetdir}\\server.zip ${puppetdir} -y'"

I'm guessing that puppet is trying to execute "C:\puppetfolder\unzip.exe", which because of the double quoted string with single backslashes, results in an invalid escape sequence as can be seen in ruby:

irb(main):004:0> "C:\unzip.exe"
SyntaxError: (irb):4: invalid Unicode escape

where \uXXXX is how you can specify literal unicode characters.

edit flag offensive delete link more

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

Stats

Asked: 2015-10-05 11:45:27 -0500

Seen: 926 times

Last updated: Oct 14 '15