2

When I use Win32 API CreateProcessAsUser() to execute a program with impersonated user in my C# .NET project, it was successful.

But I want implement that using .NET Framework API.

There is a similar method like System.Diagnostics.Process.Start() But it's not exactly same as CreateProcessAsUser().

The function CreateProcessAsUser() receives "hToken" at the first parameter. So when I duplicate a token and use it to that function, I can impersonate a user and execute a program with that user.

But the method System.Diagnostics.Process.Start() doesn't provide such a parameter.

If there is anyone who knows this, would you please let me know? Thanks

2 Answers 2

2

ProcessStartInfo has UserName and Password properties in NET 2.0 or greater.

Sign up to request clarification or add additional context in comments.

1 Comment

I want to execute a program using a process token of another process. And I already used that override you said, but it was failed because of permission deny.
1

There is no native solution. I'm sorry I disappointed you.

As Microsoft's Knowledge Base advises, You can do it only through P/Invocation (exactly like you do): https://support.microsoft.com/en-us/kb/889251

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.