Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello people. I want to run my program written on C# run as NT Authority\System, which means that it will have more privilegies as Administrator. How I can realize it?

What I have tried:

On app manifest you can change invoker as Administrator, but there are no properties for NT Authority\System.
Posted
Updated 21-Dec-20 4:01am
Comments
Richard MacCutchan 21-Dec-20 4:20am    
That is correct. It is a system protection feature.

As far as I am aware, you can't tell an app to run under any specific user as part of the application itself, but you can instruct the system to do that when you actually run it.
This may help, though I haven't tried any of them and accept no responsibility should anything untoward happen to your system or app as a result: How to Run a Program as SYSTEM (LocalSystem) Account in Windows » Winhelponline[^]
 
Share this answer
 
Comments
Ashotiklm 21-Dec-20 5:54am    
Maybe I need to create service which will be runned as NT Authority\System. I hope it will help.
It's possible to do it if your app is launched from a Windows Service. Services run as System if you don't supply a user account to run them under.

If your app requires user interaction, launching the process gets complicated. You're going to have to launch the process on the correct Desktop so the logged in user can see it, otherwise your process will launch on the service Desktop and not be visible to the user.

Launching a process on another Desktop is not an easy thing to do. It takes a considerable amount of work to accomplish this. You cannot use the Process class in the .NET Framework to launch a process on another Desktop. You have to use the Win32 function CreateProcessAsUser with an altered user token of the active console session. I leave it to you to figure out how to get that token and how to edit it.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900