title: How to configure compatibility mode from a script?
body: <p>As a part of deployment script I need to add flag "run as admin" for some app. I found where it is configured in registry, but I see that is not enough. For example, I have <code>procexp64.exe</code> in <code>C:\</code>; I'm adding string value <code>C:\procexp64.exe</code> with data <code>~ RUNASADMIN</code> in registry in <code>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers</code>. After this I see the checkbox "Run as admin" in exe properties, but actually the app isn't running as admin!  </p>
  
  <p><a href="https://i.stack.imgur.com/LVyew.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LVyew.jpg" alt="enter image description here"></a></p>
  
  <p>Ok, I removed my registry modification and configured it manually as show on the pic. The registry value appears back with the same data at the same place. I traced with <code>procmon</code> the modification and found that <code>dllhost</code> does it - it adds only one registry modification and doesn't modify anything on file system. <code>dllhosts</code>'s modification works, but my modification - not. What I'm doing wrong?<br>
  Seems like it is not enough to add reg value...<br>
  Registry virtualization was disabled, user has admin rights. Win Srv 2012 R2.</p>