-5

please anyone can help me to solve my problem.the problem is how can I run any application on my pc with different users in the domain that my pc belong I made many searches and I got the different source code.

  • Do u mean `run it as an administrator` ? – Software Dev Mar 27 '18 at 13:11
  • 3
    Hold Shift key > Right click on the application > Run as different user – danielmcn Mar 27 '18 at 13:13
  • The only way this is ontopic here is if you want to launch an executable programatically - that is, if you want to write a program that opens another program (or itself) as a different user. If that is the case, I think this will work for you: [Launch a process under another user's credentials](https://stackoverflow.com/questions/6413900/launch-a-process-under-another-users-credentials). Otherwise, see [Is there any 'sudo' command for Windows?](https://superuser.com/questions/42537/is-there-any-sudo-command-for-windows) over at superuser.com. – Theraot Mar 27 '18 at 13:17
  • yes, but I want it by C# code – baraa nabil Mar 28 '18 at 07:50

1 Answers1

0

Using Process.Start you can send it another username and securestring password to start under

https://msdn.microsoft.com/en-us/library/system.diagnostics.process.start(v=vs.110).aspx

  • many thanks for your answering, I tried with the process as you said, but it works only with the user you entered into the pc, when I use another user in our active directory I get an error, which means you must use the pc user. – baraa nabil Dec 09 '18 at 13:16