colombeen Posted June 20, 2017 Share Posted June 20, 2017 (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 June 20, 2017 by colombeen Link to comment Share on other sites More sharing options...
water Posted June 20, 2017 Share Posted June 20, 2017 Seems you need to add #RequireAdmin to one or both of your AutoIt scripts.https://answers.microsoft.com/en-us/windows/forum/windows_7-security/error-740-createprocess/b81a0a48-1de9-4127-92a0-d6ee22ebefc1https://msdn.microsoft.com/en-us/library/windows/desktop/ms681388(v=vs.85).aspx My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
colombeen Posted June 20, 2017 Author Share Posted June 20, 2017 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 Link to comment Share on other sites More sharing options...
water Posted June 20, 2017 Share Posted June 20, 2017 I'm not sure Run(As) supports UNC paths. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
colombeen Posted June 20, 2017 Author Share Posted June 20, 2017 (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 June 20, 2017 by colombeen Link to comment Share on other sites More sharing options...
AdamUL Posted June 20, 2017 Share Posted June 20, 2017 Check your permissions for the share, make sure the RunAs user has permissions to access it. Adam Link to comment Share on other sites More sharing options...
colombeen Posted June 21, 2017 Author Share Posted June 21, 2017 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? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now