title: Error Creating Logfile During Silent Installation
body: <p>I'm experiencing an error creating a logfile during an application installation script.  This is the first time I've used PowerShell for this purpose.  The reason for using it is that I need to dynamically build the option string during the installation, based on other software installed on the server.</p>
  
  <p>The <a href="https://stackoverflow.com/help/mcve">MCVE</a> to generate the error is as follows:</p>
  
  <pre><code>$cmd = '"Installer.exe" /s /v"INSTALLDIR=D:\ OPTION_1=VALUE_1 OPTION_2=VALUE_2 OPTION_3=VALUE_3 REBOOT=ReallySuppress /L*v \"C:\Temp\Install_Log.log\" /qb"'
  Invoke-Expression "cmd /c ${cmd}"
  </code></pre>
  
  <p>The error I receive is:</p>
  
  <blockquote>
    <p>Error opening installation log file.  Verify that the specified log
    file location exists and is writable.</p>
  </blockquote>
  
  <p>Note that <code>/qb</code> is being used for debugging purposes only. It will be changed to <code>/qn</code> prior to deployment; the script also fails when <code>/qn</code> is used.</p>
  
  <p>However, when I open a Command Prompt in the correct folder and paste the contents of <code>$cmd</code> into it, the application installs as expected.  It also works as expected if I remove <code>/L*v \"C:\Temp\Install_Log.log\"</code> from <code>$cmd</code>.  The log path does exist.  I have also attempted to create the log file <strong>prior</strong> to executing the installer, but this also failed.</p>
  
  <p>I'm developing and testing this in PowerShell v2.0, if that matters, since some of the servers this will be deployed to have 2.0 installed.</p>