title: Ec2Config.exe -sysprep VIA powershell Script
body: <p>So I am attempting to use Amazons Ec2Config.exe -sysprep command to sysprep an instance and prepare it to be cloned into a new AMI with the programs I require installed. The following are the last two lines of code I run in this particular powershell.ps1 script and they are where things seem to go sideways(I've tried a few different methods of executing the .exe, all yielded the same results):</p>
  
  <pre><code>cd "C:\Program Files\Amazon\Ec2ConfigService\"
  ./Ec2Config.exe -sysprep
  </code></pre>
  
  <p>If I comment these lines out, log into the instance and run the exact same commands manually, things work as expected(Which implies that all of the related xml files are properly configured). </p>
  
  <p>Now, here's where it gets interesting. When these lines are not commented out and the script runs them, I can log into the instance on which the script is being run and see the sysprep process running via process explorer, but it never finishes and the instance shuts down prematurely. </p>
  
  <p>I believe at this point, considering I can see the process running in process explorer, I've ruled out it being a permissions error(the script is being run as the "NT AUTHORITY\SYSTEM" user with the RunLevel set to Highest).</p>
  
  <p>My gut tells me that it's something related to the fact that the Ec2config.exe -sysprep does not allow you to pass in the '/quiet' option for sysprep, but I'm not certain if that matters. </p>
  
  <p>Any ideas?</p>