I need to run an executable as the current user but elevated with admin privileges (our users are not admins). The executable will get the currently logged in username and check an online service if the username exists. I’ve been trying to figure out the correct usage of RunAs but can’t seem to get it right.
If I use:
override wait
runas=currentuser
completion=job
hidden=true
The app asks for admin credentials.
If I use:
override wait
runas=localuser
completion=job
asAdmin=true
password=required
user=.\localadmin
The app reports that the current user is .\localadmin (instead of the current user).
I also tried:
override wait
runas=currentuser
completion=job
asAdmin=true
But the command failed with: “The keyword ‘AsAdmin=true’ can be used when both RunAs=localuser and Password=required are specified.”
Locally, if I open a command prompt as admin but authenticate with the local (non-admin) user’s credentials, then run the app, it produces the desired output. I’m still not quite sure how I’m able to authenticate with a standard user’s credentials here so that just adds to my confusion.
Is it possible to do what I need to do and how? Thanks in advance!