MattX Posted December 17, 2004 Share Posted December 17, 2004 Not sure why this is not working - I have gone through quite alot of threads about the RunAsSet command and I'm still stuck. The error message I'm getting is 'Unable to execute the external program. The Directory is invalid' Which is odd because if I ; out the RunAsSet command it runs fine but of couse without the rights. It needs admin rights because the killProcess.exe is a prog that kills processes better than than windows task manager. I have tried this [ as you can see ] as a local account, also as part of the domain too but still no luck - would appreciate some advice. $sPass = 'killapp' Do $sInput = InputBox( "Password Prog", "Insert password to continue" & @LF & "The password is Case Sensitive.", "", ".") If @error Then Exit If $sPass == $sInput Then ExitLoop MsgBox(4096 + 16, 'Error!', 'Password wrong.' & @LF & 'Try again.') Until 0 RunAsSet("administrator", @ComputerName, "PASSWORD") Run("C:\KillProcess\KillProcess.exe") RunAsSet() Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 (edited) Then you are using wrong password/username. Or wrong path to the exe file. I copied pasted your code, and it runs nice on my computer. $sPass = 'killapp' Do $sInput = InputBox( "Password Prog", "Insert password to continue" & @LF & "The password is Case Sensitive.", "", ".") If @error Then Exit If $sPass == $sInput Then ExitLoop MsgBox(4096 + 16, 'Error!', 'Password wrong.' & @LF & 'Try again.') Until 0 RunAsSet("user", @LogonDomain, "pass") Run("notepad.exe") RunAsSet() Edit: Copy/paste my code above, but change to your login. Edit2: You can also try to use RunWait instead of Run Edit3: Maybe you need to use the program with a command? For example wich process you wanna kill. Edited December 17, 2004 by Doxie Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
SumTingWong Posted December 17, 2004 Share Posted December 17, 2004 (edited) $sPass = 'killapp' Do $sInput = InputBox( "Password Prog", "Insert password to continue" & @LF & "The password is Case Sensitive.", "", ".") If @error Then Exit If $sPass == $sInput Then ExitLoop MsgBox(4096 + 16, 'Error!', 'Password wrong.' & @LF & 'Try again.') Until 0 RunAsSet("administrator", @ComputerName, "PASSWORD") Run("C:\KillProcess\KillProcess.exe", "C:\KillProcess") RunAsSet() I normally get that same error message when I try to launch the exe from a network location which of course is not available under the admin user context. Edited December 17, 2004 by pacman Link to comment Share on other sites More sharing options...
MattX Posted December 17, 2004 Author Share Posted December 17, 2004 (edited) This is very odd, I even tried just lauching notepad but still the same problem.I have checked and the secondary logon service is also running and the passwords and logons are ok....Tried RunWait but the same issue, also the app is a GUI so gives you list of running processes - It launches fine without the RunAsSet - which of course I don't want to do !!Then you are using wrong password/username.Or wrong path to the exe file.I copied pasted your code, and it runs nice on my computer.$sPass = 'killapp' Do $sInput = InputBox( "Password Prog", "Insert password to continue" & @LF & "The password is Case Sensitive.", "", ".") If @error Then Exit If $sPass == $sInput Then ExitLoop MsgBox(4096 + 16, 'Error!', 'Password wrong.' & @LF & 'Try again.') Until 0 RunAsSet("user", @LogonDomain, "pass") Run("notepad.exe") RunAsSet()Edit: Copy/paste my code above, but change to your login.Edit2: You can also try to use RunWait instead of RunEdit3: Maybe you need to use the program with a command? For example wich process you wanna kill.<{POST_SNAPBACK}> Edited December 17, 2004 by MattX Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 Try this code: ; Set the RunAs parameters to use local adminstrator account RunAsSet("admin", @Computername, "adminpassword") $var=AutoItSetOption ( "RunErrorsFatal", 0 ) ; Check if admin is ok If $var = 1 Then MsgBox(0, "Error", "Account is not ok.") Exit EndIf ; Run notepad as admin RunWait("Notepad.exe","",@SW_MINIMIZE) Sleep(2000) WinClose("Untitled - Notepad", "") ; Reset user's permissions RunAsSet() Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
SumTingWong Posted December 17, 2004 Share Posted December 17, 2004 Hi,The error you are gettingThe error message I'm getting is 'Unable to execute the external program. The Directory is invalid'is probably caused by an invalid working dir in your run command.You need to specify a valid working dir when using run under the admin user context.e.gRun("C:\KillProcess\KillProcess.exe", "C:\KillProcess")orRun("C:\KillProcess\KillProcess.exe", @SystemDir)and so on.... Link to comment Share on other sites More sharing options...
MattX Posted December 17, 2004 Author Share Posted December 17, 2004 Thanks Pacman - worked with the valid working dir - apprecaite all help given people - many thanks.Hi,The error you are gettingis probably caused by an invalid working dir in your run command.You need to specify a valid working dir when using run under the admin user context.e.gRun("C:\KillProcess\KillProcess.exe", "C:\KillProcess")orRun("C:\KillProcess\KillProcess.exe", @SystemDir)and so on....<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 Is this the same problem? RunAsSet("user", @ComputerName, "password") RunWait(@ComSpec & " /c " & 'copy c:\test.txt c:\test\test.txt', "", @SW_HIDE) RunAsSet() Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 (edited) This is the file i try to copy: \\xp2app02\win2000\apps\Level_B\2KSAV81\GRC.DAT To this location: C:\Documents and Settings\All Users\Application Data\Symantec\Norton AntiVirus Corporate Edition\7.5\GRC.DAT And since user is not admins, they can´t do that. So i thought running RunAsSet would solve it. But i can´t get it to work. Help EDIT: I read that i can of course not use the Computer admin, since then it will not be able to access the network. So my idea is to copy a script down to the computer and then run it. But i can´t get the FileCopy or the Copy to work. Anyone? Edited December 17, 2004 by Doxie Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Developers Jos Posted December 17, 2004 Developers Share Posted December 17, 2004 This is the file i try to copy:\\xp2app02\win2000\apps\Level_B\2KSAV81\GRC.DATTo this location:C:\Documents and Settings\All Users\Application Data\Symantec\Norton AntiVirus Corporate Edition\7.5\GRC.DATAnd since user is not admins, they can´t do that. So i thought running RunAsSet would solve it. But i can´t get it to work. Help <{POST_SNAPBACK}>You probably will loose the access to \\xp2app02\win2000\apps\Level_B\2KSAV81\GRC.DAT after you do RunAsSet()You could first copy it to @tempDir, then do the RunAsSet and Filecopy it to the Symantec directory. SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 (edited) I tried that... but its not working? RunWait(FileCopy("\\xp2app02\win2000\apps\Level_B\2KSAV81\GRC.DAT", @TempDir), "", @SW_HIDE) I get the message that it can't be located. EDIT: Its not even working if i change to: RunWait(FileCopy("c:\GRC.DAT", @TempDir), "", @SW_HIDE) Edited December 17, 2004 by Doxie Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Developers Jos Posted December 17, 2004 Developers Share Posted December 17, 2004 I tried that... but its not working?RunWait(FileCopy("\\xp2app02\win2000\apps\Level_B\2KSAV81\GRC.DAT", @TempDir), "", @SW_HIDE)I get the message that it can't be located.<{POST_SNAPBACK}>Try:FileCopy("\\xp2app02\win2000\apps\Level_B\2KSAV81\GRC.DAT", @TempDir ,1) SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 aah i should not use RunWait on FileCopy hehe Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 (edited) Its still not working? FileCopy("\\xp2app02\win2000\apps\Level_B\2KSAV81\GRC.DAT", @TempDir ,1) RunAsSet("user", @ComputerName, "pass") FileCopy(@TempDir & "\GRC.DAT", "C:\Documents and Settings\All Users\Application Data\Symantec\Norton AntiVirus Corporate Edition\7.5\GRC1.DAT") RunAsSet() The code seems to work, but still i can't copy it, i belive its a access problem. Can't i use RunAsSet with FileCopy? Edited December 17, 2004 by Doxie Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 (edited) Error: String missing closing quote RunWait('"' & @SCRIPTFULLPATH & '" /ImAdmin") RunWait('"' & @SCRIPTFULLPATH & '" /ImAdmin^ËRROR Sorry for just copy/paste, but i'm tired and have a hard time see even the most simple problems Edited December 17, 2004 by Doxie Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Doxie Posted December 17, 2004 Share Posted December 17, 2004 Sorry to bug you again Larry, but.... Still got the original error message: RunWait('"' & @SCRIPTFULLPATH & '" /ImAdmin') Error: Unable to execute the external program. Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Developers Jos Posted December 17, 2004 Developers Share Posted December 17, 2004 Sorry to bug you again Larry, but....Still got the original error message:RunWait('"' & @SCRIPTFULLPATH & '" /ImAdmin')Error: Unable to execute the external program.<{POST_SNAPBACK}>did you compile it first and that run the script.exe ?? SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
motzel Posted December 18, 2004 Share Posted December 18, 2004 Hello,i think the problem is not a rong RunAsSet ot the RunWait command I have the same problem, i think the reason is a differnet code in XP SP2 Please see this thread: http://www.autoitscript.com/forum/index.php?showtopic=6544When anybody has a solution or a work around, please say it Big thx*motzel Link to comment Share on other sites More sharing options...
Doxie Posted December 20, 2004 Share Posted December 20, 2004 did you compile it first and that run the script.exe ?? <{POST_SNAPBACK}>No, i never compiled it.. I will test it after lunch Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
motzel Posted December 21, 2004 Share Posted December 21, 2004 Hello, i have checked the problem again and again, and now i can say, that it happend when you have: windows XP Sp2 + runasset + a network drive e.g. the code for a script with the name a.exe RunAsSet("administrator", "domainname", "password") RunWait("h:\public\b.exe", "h:\public\") Exit a.exe is on the shared drive h:\public\a.exe and should only call the file h:\public\b.exe When i don't use RunAsSet it works fine, when the file a.exe and b.exe are on the local drive e.h. C:\ it works fine, but when a.exe and b.exe are on the network drive i get the error message: Error: Unable to execute the external program Please can anybody give me a tip motzel 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