1

There are lots of techniques using Win32 LogonUser() API but that requires a username & password.

Assuming the parent/invoker process has all the privileges (say a Windows Service running as localsystem), is it possible to elevate a process so that it will have admin privileges?

meraydin
  • 89
  • 1
  • 1
  • 11
  • possible duplicate of [Elevating process privilege programatically?](http://stackoverflow.com/questions/133379/elevating-process-privilege-programatically) – KeyNone Jan 02 '14 at 15:23
  • Let me clarify; What I'm after is to have a regular user (non-admin) to launch a process with admin rights. I could use "runas" verb to launch a process from the windows service but that would be a separate process which cannot interact with the user mode. I thought AdjustTokenPrivileges would be a solution but all samples require a username/password. Which I don't prefer... – meraydin Jan 02 '14 at 15:32
  • What's wrong with using the runas verb? – David Heffernan Jan 02 '14 at 19:23

1 Answers1

1

You cannot elevate an existing process to have admin privileges - the only way for a process to gain admin privileges is to start with them (e.g. by the user using "Run as administrator", or by using a manifest)

If your parent / invoker process is already elevated then any child processes launched will also be elevated by default (the difficult bit is starting a non elevated process).

See

Community
  • 1
  • 1
Justin
  • 84,773
  • 49
  • 224
  • 367