title: Puppet exec for Windows returned 2 instead of one of 0
body: <p>I'm trying to do an install by silent mode, targeting for Windows agents with the sample code below:</p>
  
  <pre><code>if ($::operatingsystem == "Windows") {
  
    file {
      "C:\\tmp": ensure =&gt; directory,
    }
  
    file {
      "C:\\tmp\fusioninventory-agent_windows_x64_2_3_12.exe": 
      ensure =&gt; file,
      #provider =&gt; windows,
      source =&gt; "puppet:///modules/${module_name}/fusioninventory-agent_windows-x64_2_3_12.exe",
      source_permissions =&gt; ignore,
      mode =&gt; 755,
      require =&gt; File["C:\\tmp"],
    }
  
    exec {
      "run-fusion-exe": path =&gt; "${::path};C:\\tmp",
  
      provider =&gt; windows,
      command =&gt; "cmd.exe /c c:\\tmp\fusioninventory-agent_windows_x64_2_3_12.exe /S /acceptlicense /debug=1 /server=http://10.1.64.149/mi-latte/plugins/fusioninventory /runnow",
      require =&gt; File["C:\\tmp\fusioninventory-agent_windows_x64_2_3_12.exe"],
      logoutput =&gt; true,
    }
  
  }
  </code></pre>
  
  <p>The first two parts is fine, except that whenever the Windows agent reaches the last portion, it attempts to execute the command (running the silent mode of the installer, instead of running the GUI interface) but often it displays </p>
  
  <blockquote>
    <p>returned 2 instead of one of 0</p>
  </blockquote>
  
  <p>To my understanding:</p>
  
  <ul>
  <li>We call <code>$path</code> as Puppet doesn't have a built-in shell for Windows.</li>
  <li>Path directories are usually specified with double backslashes as
  single slash is treated with something else.</li>
  <li>Windows commands usually start with <code>cmd.exe /C &lt;your command&gt;</code></li>
  <li>Some machines, do not allow saving files in the main <code>C:\</code> root folder
  for security reasons.</li>
  </ul>
  
  <p>If what is defined in the code is supposedly correct, including using double-quotes instead of single quotes, then I am a bit lost of why the command keeps returning 2 here that appreciate if there's something that can shed light to it while we await version 4.</p>
  
  <p>BTW, this Puppet master is using <code>3.6.0</code>, target machine is Windows <code>2008 R2 64-bit</code>.</p>