colombeen

RunAs issue

7 posts in this topic

#1 ·  Posted (edited)

Hi guys,

I'm having a RunAs issue.

I'm trying to start an autoit application I wrote  from within another autoit app with the runas command.

$app = "\\Server\Share\Path\To\File.exe"
RunAs($user, $domain, $password, 0, $app & " " & $command_line_switches, "")

When I execute this command I get error 1 and extended 740 (no explanation found so far)

Executing the exact same app using cmd works perfectly

$app = "C:\Windows\System32\cmd.exe /C START \\Server\Share\Path\To\File.exe"
RunAs($user, $domain, $password, 0, $app & " " & $command_line_switches, "")

Also another autoit app that is the "lite" version of this app (see $app) will start without the error 1 and extended 740

The only noticable difference is that the first app requires elevation

The app that executes the RunAs command is compiled and is already elevated

 

FYI 1 : I can run the application in $app perfectly from a desktop shortcut and also with runas.exe

FYI 2 : For UAC we have an app in our network called CyberArk which handles UAC popups and this application allows my autoit app to run without a popup, it just accepts the elevation, so this shouldn't be the issue

 

Anyone who has had this issue before or any ideas on how to fix this without using cmd?

Edited by colombeen

Share this post


Link to post
Share on other sites



#2 ·  Posted


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

Tried #RequireAdmin on the app calling the RunAs function : no difference...

I just think it's strange that it does work with @comspec and not with the direct path

 

pffff :(

Share this post


Link to post
Share on other sites

#4 ·  Posted

I'm not sure Run(As) supports UNC paths.


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

#5 ·  Posted (edited)

Yeah that's not the issue... the "lite" version of the first app does work and is also on a network share :)

 

(@water: It is a "full" and "lite" version of my active directory tool I made with your UDF. Full version is for internal use, Lite version is for our customers)

Edited by colombeen

Share this post


Link to post
Share on other sites

#6 ·  Posted

Check your permissions for the share, make sure the RunAs user has permissions to access it.  

 

Adam

 

Share this post


Link to post
Share on other sites

#7 ·  Posted

Hi Adam, yeah that isn' t and issue... as water stated, it's an elevation issue (error 740 is ERROR_ELEVATION_REQUIRED system error)

I just think it's strange that other apps inherit the elevation and in this case it doesn't inherit it...

Maybe this is a limitation of the RunAs part? Could it be because the elevation is for a different user, it won't pass it on to the app started by the first app?

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