Emulating runas

Emulating runas

Post by VHViaW5zb2 » Thu, 10 Jun 2004 22:06:02

I need to execute some scripts in the context of different users. I know the username and password.

I am using the following sequence of code (essentials)

CreateProcessAsUser(hUser,,_t("NET USE"),,,CREATE_NEW_CONSOLE,,..
<- this call fails. GetLastError() returns ERROR_PRIVILEGE_NOT_HEL


How can I find out which particular privilege is not being held

Alternatively - apart from runas, are there other options for running a script just once during the next time the user logs on? In particular, on this system, that will be the very first time the user logs on

Emulating runas

Post by qfel » Fri, 11 Jun 2004 02:32:13

I don't remember which one you need, but it's written somewhere in
CreateProcessAsUser docs; By default only services hold it, you can use
CreateProcessWithLogonW, it communicates with some service so if you know
username and password you can run process in different user's context form
any account.


Emulating runas

Post by Joe Richar » Mon, 09 Aug 2004 05:30:44

You need SE_TCB_NAME - Act as Part of the Operating System.


Emulating runas

Post by Aaron Marg » Sat, 14 Aug 2004 11:53:46

Take a look at CreateProcessWithLogonW.

-- Aaron