title: CreateProcessAsUser() gives "A required privilege is not held by the client" Which one?
body: <p>Using System.Diagnostic.Process.Start() from IIS Express running in my interactive session, I can execute a program running <strong>as a different user</strong> with correction functionality.  Unfortunately, it seems that this doesn't work from non-interactive sessions.</p>
  
  <blockquote>
    <p>Process.Start internally calls CreateProcessWithLogonW(CPLW) when
    credentials are specified. CreateProcessWithLogonW cannot be called
    from a Windows Service Environment (such as an IIS WCF service). It
    can only be called from an Interactive Process (an application
    launched by a user who logged on via CTRL-ALT-DELETE).
    -- <a href="https://stackoverflow.com/a/15688675/162273">from this SO answer</a></p>
  </blockquote>
  
  <p>I need to publish this site to IIS 8 from the app pool account.  So I CreateProcessAsUser as suggested by the above-quoted answer.  I've set the service account and agent account with Local Security Policies and restarted as suggested in that answer - service account can replace token, modify quotas and agent account can logon as batch (and as service for that test).  But I can't get it to work in IIS Express (or a console test app) nor IIS 8.  I've tried running as <code>LOGON32_LOGON_BATCH</code>, <code>LOGON32_LOGON_NETWORK_CLEARTEXT</code>, and <code>LOGON32_LOGON_SERVICE</code>, and even <code>LOGON32_LOGON_INTERACTIVE</code>.  I've even given my own account "logon as service" and "act as part of the operating system" privilege with no change - all tested after a reboot.</p>
  
  <p>I'm getting "A required privilege is not held by the client" from IIS Express for all configurations.  On the server, I get the same running the console app.  But publishing the app, it seems to start the process just fine, but then I seem to be getting permissions errors subsequently.</p>
  
  <p>I'd like to know WHICH privilege my accounts are missing when running locally so I can debug them properly (and eventually figure out whatever permissions error I'm getting).  Is there any way to determine that?  Either way, if you know what the issue is, I'd like that too!</p>
  
  <p>Thanks!</p>