Is it possible to run a windows form application or a console application under system account... Like asp.net application can run under system account by changing machine config file . This is to give more privileges to the program ...
Yes. You can run any app under the system account. One technique is to launch it as a scheduled task, or by using the "at" command line utility.
Unfortunately, however, since Windows Vista, applications run in this way can't interact with the user, since they run in a different session.
This means that running a WinForms (or any kind of GUI, really) application in this way is kinda pointless. Similarly for a console app, if you want to see the output.
If it's for a one-off, you can probably live with it. Otherwise, you should be looking at creating a Windows Service, which can be configured to run under any user account (including SYSTEM). If you want to interact with it, you'll need to implement a separate app that talks to it through (e.g.) .NET remoting.
Two ways to get a program to run under a different user context than the one you're currently logged on as:
Use the RUNAS command
RUNAS /user:USERNAME PROGRAMNAME
Example:
RUNAS /user:YOURDOMAIN\ADMINISTRATOR NOTEPAD.EXE
This will pop open a console window asking for the password. The RUNAS command can not be given a password through the command line, it has to be typed in by the user for security reasons.
Create a shortcut to the program that runs it under different credentials
First create the shortcut, then edit the properties of it, and on the first tab, click Advanced. On the dialog that pops up, check the "Run with different credentials".
When you start the program through the shortcut, it will pop up a dialog asking for which username and password you wish the program to run under. Again you cannot store the username and password for security reasons.
If you want to create a shortcut or similar that automatically selects a new user context, then I'm afraid you need to find a tool online, unless you mean to run the program as a service or similar.
That depends on what your goal is. If you want it to run under the system account and let a user interact with it, you can't do that. If you absolutely need to do this your best bet it to create a service that handles the operations that require additional priveleges and runs as System, and the connect to that service from a GUI running as user. However, if you go this route, realize that you're creating a hole in the security boundary between what a standard user can do and what System can do so be sure you protect the connection between the GUI and the service and limit the scope of the service to only what you absolutely need it to do.
As lassevk mentions if you just need to do this once or occasionally you can use runas to run in another security context but still have an interactive GUI / console.
On the other hand, if you just want it to run unattended at a certain time, you should be able to use the task scheduler like Martin suggests.
It sounds like you're attacking the symptom rather than the problem. What exactly does your program need to do that requires additional permissions? Maybe there's a different way of accomplishing that task without requiring any kind of elevation.
can any one help me my problem is
executing the notepad.exe at the client side well i am using asp.net c# it has to work when iis server is installed
please provide me some code for it
pleeeeeeeeeeeeeeeeee
my emailid- [email protected]