0

Hello i'm currently working on a Admin program that do a lot of thing.

In the end it launch another program. I have the username i want to launch it. But not the password.

Can i with ProcessStartInfo run as my AD user without having the password?

Like a su in linux. Admin don't need to know user pass to su into their account.

My code is in C#

And ATM i use it like this

            Process.Start(desktop + "\\Application");

Application is the desktopShortcup to launch my app.

Jebik
  • 778
  • 2
  • 8
  • 26
  • [This](https://stackoverflow.com/questions/3770476/how-to-launch-program-with-user-permissions-instead-of-active-permissions) might help maybe? – npinti Sep 28 '18 at 12:19
  • Possible duplicate of [Launch application with less permissions than "Run As Admin"](https://stackoverflow.com/questions/35479722/launch-application-with-less-permissions-than-run-as-admin) – Ken White Sep 28 '18 at 12:21
  • Possible duplicate of [How to start a new process without administrator privileges from a process with administrator privileges?](https://stackoverflow.com/questions/11169431/how-to-start-a-new-process-without-administrator-privileges-from-a-process-with) – Eric Damtoft Sep 28 '18 at 12:46
  • You could make a wrapper application - this starts the app you want to run as admin with /runas and a second as normal user which can start apps as normal user. So "Wrapper.exe" starts "MyAdmin.exe" (as admin) and "MyLauncher.exe" - when "MyAdmin.exe" wants to start an .exe as normal user it tells "MyLauncher.exe" to do so. – Rand Random Sep 28 '18 at 12:59

1 Answers1

0

If you overload Process.Start with ProcessStartInfo, you can specify a UserName and Password to run the process as.

       Process.Start(new ProcessStartInfo { UserName = "...", Password = passwordAsSecureString, FileName = desktop + "\\Application" });
Eric Damtoft
  • 1,353
  • 7
  • 13
  • Sadly i don't have Password... And i can't ask user ... This process is a Update process so it must be run without user input. – Jebik Sep 28 '18 at 12:35
  • There are a few options listed [here](https://stackoverflow.com/questions/11169431/how-to-start-a-new-process-without-administrator-privileges-from-a-process-with) (possibly duplicate?), but unfortunately there's no particularly clean way to handle it. – Eric Damtoft Sep 28 '18 at 12:45
  • Yeah i didn't found it and finally i use the way with explorer.exe listed on this last page – Jebik Sep 28 '18 at 14:08