Jump to content

RunAs


Recommended Posts

Hello,

i've just downloaded AutoIT because i have to handle a problem. I got a user in my domain who has to start a unlocker for the WD My Passport (encrypted external HDD). The Unlocker path is "O:WD Drive Unlock.exe", this one needs admin rights.

Edit: The Drive "O" is an simulated CD-Drive but i think it doesnt botther.

I've just wrote this code but doesnt work for me :

RunAs ("install",@ComputerName,"installPassword",1, "WD Drive Unlock.exe","O:\")
Edited by MarcWWS
Link to comment
Share on other sites

Welcome to AutoIt and the forum!

"install" is a local or a domain user?

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

"install" is a local and a domain user. but when i execute the .exe i says domain authentification

RunAs ("install","wiwe.local","installPassword",1, "WD Drive Unlock.exe","O:\")

doesnt work,too.

RunAs ("install","wiwe.local","installPassword",1, "notepad.exe","")

This with the notepad work, did it just to test it.

Edited by MarcWWS
Link to comment
Share on other sites

Is "WD Drive Unlock.exe" located on o: as well?

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

You have to specify the full path:

RunAs ("install","wiwe.local","installPassword",1, "O:\WD Drive Unlock.exe","O:\")

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

OK, the UAC is enabled : RunAs will execute the program with admin rights (if "install" is an admin account) but won't elevate the privileges. So you can't skip the UAC prompt easily.

You have to use #RequireAdmin at the top of you code.

Link to comment
Share on other sites

Now it executes the programm. But i thaught i can write this that a normal user without admin can execute the Programm. In my company not every one got admin rights. So i thaught i can write this programm that every customer (without admin rights) can use the external HDD.

Atm i got this :

#RequireAdmin
RunAs ("install","wiwe","installPassword",2,"O:\WD Drive Unlock.exe","O:\")

When i run this with the normal user it ask me to enter Admin user but after entering it the Unlock.exe starts. What i need is that i dont need to enter admin.

Edit: I wrote a 2nd script now that executes this script and this works :geek:  i dont know why and if this is the right way but till it works its fine..

Edited by MarcWWS
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...