Page 1 of 1
Run an other program as different user
Posted: Wed Apr 23, 2025 11:46 am
by Marc Vanzegbroeck
Hi,
I need to run another program with a different user/password , than my program, from my program.
That other program have to have other right to access a server to get data, but that user/password,can't access the things that my program is using...
Is that possible?
It's something as the RUNAS-dos-command,but that one ask me the password.
Thanks
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 12:05 pm
by Natter
If I understood correctly:
There is a general user directory on the server
Full name, password, rights fields
If you run the program from your program, then all this can be passed as parameters
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 12:21 pm
by Marc Vanzegbroeck
No, my program can access everything from the PC.
The other user can only access data from another (OPC)-server. Only that user has access to get data from that system.
My program will call the other program(with other credentials), and that program return data(it place data on a specific place that my program can access) , that my program will use.
The reason why only that other user can access the other server, is that this is used in a chemical plant, and the normal user may not access the other server. They give me a login than I can use in my program to access that data, but the users may not know the user/password
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 12:27 pm
by Natter
So, specifically, it doesn't work ?
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 1:01 pm
by Marc Vanzegbroeck
In the info of the runas-command:
Enter the password when prompted. The RunAs program demands that you type the password manually. This was a conscious design decision. If it were possible to pass the password on the command line, people would start embedding passwords into batch files and logon scripts, which is laughably insecure
There is a possibility to use the /savecred, but the I have to enter the password manualy one time.
I see that the runas() function in Autoit can handle passwords. I will try it.
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 1:14 pm
by Natter
RunAs - 'is this the FW or Clipper function ? If you want to enter the password automatically, then find the handle of the window and the item on it. And enter the password(sendmessage) in this element
Re: Run an other program as different user
Posted: Wed Apr 23, 2025 1:25 pm
by Marc Vanzegbroeck
No, runas.exe is standard Microsoft commandline-program located in %windir%\System32\runas.exe...
I see that there are different alternative programs for it.
I will try those.