title: How to silent install .msi not within elevated command prompt
body: <p>So recently I've built a <code>.msi</code> file and I have no problem installing by double clicking on it.<br />
  However when I try to silent install it in command prompt <code>msiexec /i product.msi /qn</code> there will be privilege error:</p>
  <pre><code>Error 1303. The installer has insufficient privileges to access this directory: C:\Program Files (x86)\Company.  The installation cannot continue.  Log on as administrator or contact your system administrator.
  </code></pre>
  <p>One solution I found is set <code>InstallScope=&quot;perMachine&quot;</code> under package element but it's not working for me because I'll get another privilege error</p>
  <p>After some googling I realized I can install it with elevated command prompt, but I'm still wondering whether I can install it without elevated command prompt</p>
  <p>below is roughly what my <code>.wxs</code> looks like:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;Wix xmlns=&quot;http://schemas.microsoft.com/wix/2006/wi&quot;&gt;
      &lt;Product Name=&quot;Product&quot; Manufacturer=&quot;Company&quot; Version=&quot;1.0.0&quot;
               Id=&quot;GUID&quot;
               UpgradeCode=&quot;GUID&quot;
               Language=&quot;1033&quot; Codepage=&quot;1252&quot;&gt;
          &lt;Package Id=&quot;*&quot; Compressed=&quot;yes&quot;/&gt;
          &lt;Condition Message=&quot;This application only support 64-bit Windows OS&quot;&gt;VersionNT64&lt;/Condition&gt;
  
          &lt;!-- for some reason these are necessary --&gt;
          &lt;Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt=&quot;CD-ROM #1&quot; /&gt;
          &lt;Property Id='DiskPrompt' Value=&quot;Acme's Foobar 1.0 Installation [1]&quot; /&gt;
  
          &lt;!-- Step 1: Define the directory structure --&gt;
          &lt;Directory Id=&quot;TARGETDIR&quot; Name=&quot;SourceDir&quot;&gt;
              &lt;Directory Id=&quot;ProgramFilesFolder&quot;&gt;
                  &lt;Directory Id=&quot;ProgramFilesFolderCompany&quot; Name=&quot;Company&quot;&gt;
                      &lt;Directory Id=&quot;INSTALLDIR&quot; Name=&quot;Product&quot;/&gt;
                  &lt;/Directory&gt;
              &lt;/Directory&gt;
          &lt;/Directory&gt;
  
          &lt;!-- Step 2: Add files to your installer package --&gt;
          &lt;DirectoryRef Id=&quot;INSTALLDIR&quot;&gt;
              &lt;Component Id=&quot;MainExecutable&quot; Guid=&quot;GUID&quot;&gt;
                  &lt;File Id=&quot;MainExecutableEXE&quot; Source=&quot;product.exe&quot; KeyPath=&quot;yes&quot; Checksum=&quot;yes&quot;/&gt;
              &lt;/Component&gt;
          &lt;/DirectoryRef&gt;
  
          &lt;!-- Step 3: Tell WiX to install the files --&gt;
          &lt;Feature Id=&quot;Complete&quot; Level=&quot;1&quot;&gt;
              &lt;ComponentRef Id=&quot;MainExecutable&quot; /&gt;
              &lt;ComponentGroupRef Id=&quot;Examples&quot; /&gt;
              &lt;ComponentGroupRef Id=&quot;Scripts&quot; /&gt;
          &lt;/Feature&gt;
      &lt;/Product&gt;
  &lt;/Wix&gt;
  </code></pre>
  <p>Thanks for the help!</p>