buymeapc Posted May 5, 2008 Posted May 5, 2008 Ok, this should be pretty simple, but I'm slamming my head into a wall. I have a script that is being run by the SYSTEM account, but I need it to launch applications using a local admin account. I've dumbed the script down to its most simple level. RunAsSet("station100", @ComputerName, "password") Run("notepad.exe", @SystemDir) In return, I keep getting: Line -1: Error: Unable to execute the external program. Access is Denied. What am I doing wrong?
Developers Jos Posted May 5, 2008 Developers Posted May 5, 2008 Ok, this should be pretty simple, but I'm slamming my head into a wall. I have a script that is being run by the SYSTEM account, but I need it to launch applications using a local admin account. I've dumbed the script down to its most simple level. RunAsSet("station100", @ComputerName, "password") Run("notepad.exe", @SystemDir) In return, I keep getting: Line -1: Error: Unable to execute the external program. Access is Denied. What am I doing wrong?Try specifying the whole path to the program you are starting: Run(@SystemDir & "\notepad.exe", @SystemDir) 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.
buymeapc Posted May 5, 2008 Author Posted May 5, 2008 (edited) Ok, now I'm getting: Line -1: Error: Unable to execute the external program. The parameter is incorrect. Edit: Ooops...I forgot the "\" in front of the notepad.exe. I am still getting the same results as before. I also checked the Secondary Login Service to see if it's running and it is. I'm not sure why this is happening... Edited May 5, 2008 by buymeapc
buymeapc Posted May 6, 2008 Author Posted May 6, 2008 Sorry for the bump, but I'm really stumped on this one and can't get past it.
Developers Jos Posted May 6, 2008 Developers Posted May 6, 2008 (edited) Did you use the line exactly as I typed ? How are you starting the script ? Does the script work when executed by your own account on the PC? Jos Edited May 6, 2008 by Jos 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.
buymeapc Posted May 6, 2008 Author Posted May 6, 2008 The code I am using is: RunAsSet("station100", @ComputerName, "password") Run(@SystemDir & "\notepad.exe", @SystemDir) I copied/pasted your line of code into my script. The script works fine when executed as the local admin account - everything works great that way, but it is instead being automatically run by the SYSTEM account which causes this error.
Developers Jos Posted May 6, 2008 Developers Posted May 6, 2008 You didn't specify how the script is started with the system account... are you using the Scheduler ? 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.
buymeapc Posted May 6, 2008 Author Posted May 6, 2008 Oh, I'm sorry.... I'm using a program called DeepFreeze made by Faronics. It has a built in batch file that can call files located on the drive. I'm calling the script using this command: START "" "C:\SetUp Apps\Dyna-Update\Dyna-Update.exe" I use the "" so that the command prompt box disappears while the script is executing (so the window doesn't get in the way)
Developers Jos Posted May 6, 2008 Developers Posted May 6, 2008 Ok... I can simulate it by using the AT command: c:>at 18:54 /interactive "C:\temp\script.exe" Will do some testing. 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.
buymeapc Posted May 6, 2008 Author Posted May 6, 2008 Ok, thanks....I'm still trying things on my end, too.
Developers Jos Posted May 6, 2008 Developers Posted May 6, 2008 Wondering if it is allowed at all to change the credentials when running under the SYSTEM account. Does anybody know or have any experience with this ? 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.
buymeapc Posted May 6, 2008 Author Posted May 6, 2008 There is an option under DeepFreeze, but I have had no luck at all with it, so I figured I'd try it in the script I am using - and here I am lol.
Developers Jos Posted May 6, 2008 Developers Posted May 6, 2008 Just tried the following scenario to test my previous point: 1. Schedule CMD with AT to run the command prompt with SYSTEM credentials: at 19:39 /interactive "cmd.exe" 2. In the opened CMD prompt try running RunAs. This gives the error: " 5: Access is denied." 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.
buymeapc Posted May 7, 2008 Author Posted May 7, 2008 So, is there any way to make this work in your opinion?
Kudzu309 Posted May 12, 2008 Posted May 12, 2008 Looks like RunAsSet is in the 3.2.10 help file but it doesn't exist in the API: http://svn.autoitscript.com/trac/ticket/174. It is fixed in the 3.2.12 beta:16th May, 2008 - v3.2.12.0AutoIt:Removed: Unnecessary optional parameter from ProcessClose(). Removed: RunAsSet(). (Replaced with RunAs() and RunAsWait())etc......but in the BugTrack it says that 3.2.10 supports RunAs, so here's the syntax if you don't want to load the beta:RunAs ( "username", "domain", "password", logon_flags, "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )Steve
Administrators Jon Posted May 13, 2008 Administrators Posted May 13, 2008 IIRC the 3.2.10.0 version does not work with RunAs and the SYSTEM account. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
AHarkeyCCS Posted May 28, 2008 Posted May 28, 2008 Hello all, I found that this works well. if not IsAdmin()Then Local $pid = runaswait("administrator", @computername, "**", 0, "\\ServerName\nonmsipkg\dvd\setup.exe /s",@SystemDir) ProcessWaitClose($pid) elseif IsAdmin() Then Run("Setup.exe",@Scriptdir) EndIf The Error 1 is because your testing you script with admin right to the workstation. You will need an If IsAdmin() Then
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