Sign in to follow this  
Followers 0
Tum

Executing a program with admin rights ?

8 posts in this topic

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
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 ?

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0