CreateProcessAsUser error 1314

The local account that is running your app must have these privileges enabled in the Local Security Policy:

  • Act as part of the operating system
  • Create a token object
  • Log on as a batch job

Edit: Please see Patel's answer below. The correct privilege in this case should be:

  • "Replace a process level token"

After looking for answer for hours, I finally found it in following link from MSDN. Hope it may help someone in future.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/c905c900-cae1-4081-b0c9-00f10238e7ad/createprocessasuser-failed?forum=clr

"To resolve this problem, you'll need to elevate the rights of the account calling CreateProcessAsUser with the "Replace a process level token" right. To do so, open the Control Panel / Administrative Tools / Local Security Policy and add the user account to the "Replace a process level token" right. (You may have to logout or even reboot to have this change take effect.)"