Jump to content

Executing a program with admin rights ?


 Share

Recommended Posts

Hi,

Thanks for a great program, Seems fairly easy to get to grips with.

Problem am having at the minute is executing a program that requires admin rights.

Ive search google and found the command "#RequireAdmin" which obviously executes the program, but am still required to click Yes on the "User Account Control"

Which for some reason AutoIT cannot click.

Also i have tried using the "RunAs" command but still doesnt work.

Also in properties on the actually program ive ticked the box for "Run this program as an admistrator"

Could someone please help me sort this out ?

Thanks

Link to comment
Share on other sites

Welcome to Autoit and the forum!

What do you mean by

"Also i have tried using the "RunAs" command but still doesnt work.

We need more information so we can help you.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

What I've done over here, is setup a task that runs at highest permissions. That task can run a exe, or au3 file, which will not require you to click the allow rights, and can be started with a simple batch file. You can also start your script from an admin cmd prompt to get arround the same issue.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Welcome to Autoit and the forum!

What do you mean by We need more information so we can help you.

Hi,

When i say i have tried using the command i have used it like this :

RunAs("USERNAME", "SYSTEM", "PASSWORD", 0, "C:UsersDave-2DownloadsD3-IMneytiri.exe")

the program am trying to load is called neytiri.exe

I have set the program in its preferences to run as an admistrator, but i still get the "User Account Control" box popping up, and have to press "Y"es to run the program. I cant get AutoIT to click this Y as well.

Is there a way to stop the "User Account Control" popping up, and automatically run the program.

Link to comment
Share on other sites

Actually, i just tried it using this command line.

Run("C:UsersDave-2DownloadsD3-IMneytiri.exe")

But the program just doesnt seem to run at all. Even though if i click the program link for the desktop it runs fine.

But when it runs (after i click it from the desktop) it brings up the command box "User Account Control" which autoit still doesnt seem to be able to click Yes to anyway.

So my problem are these.

1) The program itself doesnt even execute.

2) and if it did execute, how can i get autoit to click the "Y"es in the "User Account Control".

Thanks for any help :D

Link to comment
Share on other sites

The program itself doesnt even execute.

Have you tried ShellExecute, not sure about running it in admin however.

Edit: You could try using controlclick to click the yes button however I have never really played around with this function and couldn't give you any advice on it. However it may be what your looking for.

Edit 2: After further research on the forums I don't beleive its possible to automate the UAC window for security reasons but good luck if you manage to find a fix :D.

Edited by Venix
Link to comment
Share on other sites

Thanks for your reply.

ShellExecute runs the program, thanks a lot.

But ye now am struggling with the UAC popup that i cannot access :D

Anyone got any other method that might allow me to click the yes button in UAC popup please ?

Link to comment
Share on other sites

Ah, i found that now the #RequireAdmin command does the trick

PUtting this makes the script require admin, but then doesnt ask for it when the script tries to run the program that required it :D

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...