title: Impersonate SYSTEM (or equivalent) from Administrator Account
body: <p>This question is a follow up and continuation of <a href="https://stackoverflow.com/questions/2932461">this question</a> about a Privilege problem I'm dealing with currently.</p>
  
  <p><br><br>
  <strong>Problem Summary:</strong><br>
  I'm running a program under a Domain Administrator account that does not have <code>Debug programs (SeDebugPrivilege)</code> privilege, but I need it on the local machine.</p>
  
  <p><br>
  <strong>Klugey Solution:</strong><br>
  The program can install itself as a service on the local machine, and start the service. Said service now runs under the <code>SYSTEM</code> account, which enables us to use our <code>SeTCBPrivilege</code> privilege to create a new access token which does have <code>SeDebugPrivilege</code>. We can then use the newly created token to re-launch the initial program with the elevated rights.</p>
  
  <p><br>
  I personally do not like this solution. I feel it should be possible to acquire the necessary privileges as an Administrator <em>without</em> having to make system modifications such as installing a service (even if it is only temporary).</p>
  
  <p>I am hoping that there is a solution that minimizes system modifications and can preferably be done on the fly (ie: Not require restarting itself). I have unsuccessfully tried to <code>LogonUser</code> as <code>SYSTEM</code> and tried to <code>OpenProcessToken</code> on a known SYSTEM process (such as csrss.exe) (which fails, because you cannot <code>OpenProcess</code> with <code>PROCESS_QUERY_INFORMATION</code> to get a handle to the process without the privileges I'm trying to acquire).</p>
  
  <p>I'm just at my wit's end trying to come up with an alternative solution to this problem. I was hoping there was an easy way to grab a privileged token on the host machine and impersonate it for this program, but I haven't found a way.</p>
  
  <p><br><br>
  If anyone knows of a way around this, or even has suggestions on things that <em>might</em> work, please let me know. I really appreciate the help, thanks!</p>