Jump to content

RunAsWait - Elevating permissions

Recommended Posts


I'm new to AutoIt so please forgive my stupidity.

I've been browsing through the forums looking for examples on how to install applications using the RunAsWait function.

When I read the description of this function it sounded like it has the ability to run the installation of a piece of software using a different

set of credentials rather then that of the person logged into the computer.

I took a small piece of code I found in the forums and built a small test script:

I should mention to that the domain account I am using is a domain admin

I am testing in: Windows 7 x64 bit with the UAC turned OFF

I did no special options to compile the .exe as a 64bit .exe for compatibility reasons.

Global $sUserName = "someruser"
Global $sPassword = "someuser"
Global $sNetwork = "domain"
;install current verison of flash player
RunAsWait($sUserName, $sNetwork, $sPassword, 2, "pathtonetworkshareinstall_flash_player_11_active_x_11.2.202.233_64bit.exe -install")

I then compiled the code into an .exe

I did two tests - 1 using the local administrators account and 1 using a domain account.

Test 1 - With Local administrator account

I first had to make sure that the local administrator had access to the network share. I mapped a drive to the share and I executed the .exe.

The .exe ran and installed Adobe Flash without issue

Test 2 - With a domain account

The domain account I am using is a regular user and this user does not have Local Administrative privileges on the computer.

I run the .exe once I have logged in as this user. They already have access to the network share so I didn't need to map the drive directly.

The .exe does not install Adobe Flash.

To prove to myself that at least the .exe was actually be executed I added in some MsgBox's.

When I ran the modified .exe I got the MsgBox's popping up, but still no install of Adobe Flash.

So my question is, is my understanding of the purpose of the RunAs and RunAsWait functions wrong? Can you not

have them install software for users who do not have Local Administrative privileges?

Or is there a step that I am missing?

I should add as well that I have tried setting the "#RequireAdmin" option and that doesn't appear to work either.

Would someone maybe be able to steer me towards some additional examples or offer advice?

Thank you.

Edited by bourneNolonger
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...