Questions tagged [createprocessasuser]
114 questions
17
votes
2 answers
starting a UAC elevated process from a non-interactive service (win32/.net/powershell)
I'm using a thrid party Windows service that handles some automation tasks by running scripts and executables using CreateProcessAsUser(). I'm running into problems on Windows Server 2008 due to UAC and way the LUA elevation is handled through the…

Chris Sears
- 6,502
- 5
- 32
- 35
17
votes
4 answers
CreateProcessAsUser error 1314
I want create a process under another user. So I use LogonUser and CreateProcessAsUser. But my problem is, that CreatePtocessAsUser always returns the errorcode 1314, which means "A required privilige is not held by the client". So my question is,…

kampi
- 2,362
- 12
- 52
- 91
13
votes
3 answers
Calling CreateProcessAsUser from C#
I've been attempting to create a new process under the context of a specific user using the CreateProcessAsUser function of the Windows API, but seem to be running into a rather nasty security issue...
Before I explain any further, here's the code…

Noldorin
- 144,213
- 56
- 264
- 302
10
votes
3 answers
Windows 2008 RenderFarm Service: CreateProcessAsUser "Session 0 Isolation" and OpenGL
I have a legacy Windows server service and (spawned) application that works fine in XP-64 and W2K3, but fails on W2K8. I believe it is because of the new "Session 0 isolation" feature.
Consequently, I'm looking for code samples/security settings…

holtavolt
- 4,378
- 1
- 26
- 40
9
votes
2 answers
example code: A service calls CreateProcessAsUser() I want the process to run in the user's session, not session 0
I am seeking example code:
For a service calls CreateProcessAsUser() I want the process to run in the user's session, not session 0
thus far the created process is only running like a service in session 0

kevinwaite
- 613
- 1
- 8
- 20
8
votes
1 answer
why is CreateProcessWithTokenW failing with ERROR_ACCESS_DENIED
I have a call to CreateProcessWithTokenW that is failing with access denied. Any ideas how to debug this?
The call to CreateProcessWithTokenW is here: https://github.com/fschwiet/PShochu/blob/master/PShochu/PInvoke/NetWrappers/ProcessUtil.cs
For…

Frank Schwieterman
- 24,142
- 15
- 92
- 130
8
votes
1 answer
Capture standard output from CreateProcessAsUser in C#
I'm currently starting processes within an asp.net website using the pinvoke CreateProcessAsUser api. This works perfectly to impersonate the logged on AD user.
Somehow however the result string from the console output is always empty. I can't find…

Bjorn Lievens
- 81
- 1
- 2
6
votes
0 answers
Redirect output for CreateProcessAsUser
I have recently implemented CreateProcessAsUser. I have been trying to get the output results either redirected or piped to a file. Preferable to stream.
I have tried this with no luck
Update
Requirements are:
Windows Service Application
Logged…

H20rider
- 2,162
- 5
- 29
- 47
6
votes
1 answer
LogonUser -> CreateProcessAsUser from a system service
I've read all the posts on Stack Overflow about CreateProcessAsUser and there are very few resolved questions, so I'm not holding my breath on this one. But it seems like I'm definitely missing something, so it might be easy.
The target OS is…

joshk0
- 2,574
- 2
- 25
- 36
5
votes
0 answers
Loading user profile from a service
In a service, I try to use the following code to launch a program :
HANDLE hPipe;
HANDLE hToken;
PROFILEINFO stProfileInfo;
char szUserName[64];
DWORD dwUserNameSize = 64;
// Take the identity of the client
ImpersonateNamedPipeClient(hPipe);
//…

Emmanuel BERNAT
- 793
- 6
- 17
5
votes
1 answer
How do I get a valid user token for CreateProcessAsUser?
I have an application that is running as normal user, and a service running as local system. I want the application to be able to tell the service to start the application again, once the service has done some other stuff. (So the application will…

Björn
- 51
- 1
- 3
5
votes
2 answers
How to start a Console App as running under the System Windows user account?
I tried
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = filename,
UserName = "System",
UseShellExecute = false,
},
};
process.Start();
but it yields
Win32Exception was unhandled
Login…

Jader Dias
- 88,211
- 155
- 421
- 625
5
votes
1 answer
Rediredting stdout for createprocessasuser to pipe hangs on read
I'm using CreateProcessAsUser to run a process from a service, and am redirecting the stdout to a named pipe. But when I try to read from the named pipe it hangs on the read and never returns.
I tried this in a separate task(as currently…

ee4392582
- 51
- 2
4
votes
1 answer
Why CreateProcessAsUser fails with "Access denied" when called from service child process
I am trying to run process as other user from my service using CreateProcessAsUser function. The example of code was found here CreateProcessAsUser from c++ service creates process but no console.
OS - Windows 10
My code is working fine, when i run…

Oleg Nloge
- 81
- 6
4
votes
4 answers
How to get Currently logged user's session ID?
I'm running a process from inside a windows service using
ProcessStartInfo processStartInfo = new ....
Process.Start(processStartInfo);
The problem is, if I run service under local system account, it runs alright, but it doesn't show the programs'…

iLemming
- 34,477
- 60
- 195
- 309