I am trying to automate a few things with a few scripts. One of the users in my PC has no admin privileges (I have a "Work" user and a "Gaming" user and I don't want the latter to be admin by default).
However sometimes I need to grant adminprivileges (sometimes when a game lauches asks for elevated privileges, or when installing a new game). When I'm on the computer there's no problem because I can always type in my admiin password, but now I'm trying to automate a few things and the only solutions I find to launch processes with elevated privileges is to use runas
.
However this doesn't work as I want to, because this makes the admin account launch the process, so any user-dependant behaviour (for instance, steam being logged into my account).
I need a way to launch a program as a non-admin user and grant it elevated privileges in a way that I can automate.
So far I have tried running a task at the task scheduler that runs the task as the non-admin user and I have the check box "Run with highest privileges" but it doesn't work f the user running the task is non-admin.
EDIT: Just to make it clear, I'm fine with a solution that requires me to input admin password when I run the program. However the outcome should be that the process is run as the regular user (for instance, opening cmd, typing echo %username%
and getting the non-admin account name, instead of the admin account name)