WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

RunWithLogon wntRunAsUser LocalSystem Account

 Keywords: RunWithLogon wntRunAsUser LocalSystem Account Error 1932 

Question:

Can the Runwithlogon function be used while running in the local system context to run a program in the context of a domain user?

Answer:

From the Microsoft Platform SDK: Windows XP SP2 and Windows Server 2003: You cannot call CreateProcessWithLogonW from a process that is running under the LocalSystem account, because the function uses the logon SID in the caller token, and the token for the LocalSystem account does not contain this SID. As an alternative, use the CreateProcessAsUser and LogonUser functions.

Internally, RunWithLogon() makes use of CreateProcessWithLogonW(), so the scenario under which you want to use it is not permitted.

When running as Local System, you need to load the NT extender and make use of wntRunAsUser(), which won't have any issues with the privs required to to call LogonUser() since Local System implicitly has those privs granted to itself at all times.


Article ID:   W17898
Filename:   RunWithLogon wntRunAsUser LocalSystem Account.txt
File Created: 2008:05:15:08:33:14
Last Updated: 2008:05:15:08:33:14