Elevate compiled script exe without UAC dialog

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Elevate compiled script exe without UAC dialog

Post by Grovkillen » Wed Apr 01, 2020 6:15 pm

If you have a user account with admin rights or if you want to use the admin account you can do so and not have the UAC dialog pop-up.

Code: Select all

Let>EXE_PATH=cmd.exe
RunProgram>runas /user:%COMPUTER_NAME%\admin "%EXE_PATH%"
Wait>1
Send>SuP3rP455W0rD
Press>Enter
The above code will open the command tool as the "admin" account. The wait 1 is just used to wait for the command line terminal to show before sending the user account's password and press enter. You now got a elevated cmd.exe.

This would be used to have your script selfcheck if it's running with admin rights, if not execute self like this.

Your computers admin account is easily found by running "compmgmt.msc" from the search (Win+R). I usually rename my administrator account to "admin" and set the password to a default one.
Let>ME=%Script%

Running: 15.0.27
version history

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Re: Elevate compiled script exe without UAC dialog

Post by kpassaur » Mon Dec 06, 2021 12:40 pm

Thank you I will give it a go

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts