Jump to content

trigger "runas" another user


Recommended Posts

Hello,

I need to somehow trigger the runas function without providing any username or password, I let UAC about that, so I need the user to enter the username and password.

Run as administrator will trigger the UAC login box, but I can't use that one, because I need to run the script with a domain administrator on startup.

Link to comment
Share on other sites

1 hour ago, FrancescoDiMuro said:

@legend
InputBox(es) or a simple GUI in which the user set username and password should do the trick :)

that would work, but if it's possible to use the UAC login prompt, that would be better, using a inputbox feels a bit wrong, sort of untrustworthy

Link to comment
Share on other sites

You can force Windows to display a UAC prompt for a process, if the user does not have the Admin Token, by using the "runas" verb in the ShellExecute or ShellExecuteWait functions.  There are examples on the forum using this technique.    

If you want to go the dialog route.  Have a look at _WinAPI_ShellUserAuthenticationDlg or _WinAPI_ShellUserAuthenticationDlgEx, for a proper authentication dialog box.  You could then use the credentials in the RunAs command.    

 

Adam

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...