sshrum Posted October 6, 2005 Share Posted October 6, 2005 (edited) I'm trying to run a program as local admin from a compiled AutoIT script (here's the script):$command = "h:\apps\gx260bios\setup.exe /s /v /p" $user = "Administrator" $pass = "adminpass" $domain = @ComputerName ;=========== If Not IsAdmin() Then if RunAsSet($user, $domain, $pass, 0) = 0 then msgbox(0,@ScriptName,"OS doesn't support running as another user") Exit EndIf EndIf Run($command, "c:\") RunAsSet()I've tried a number of variations (the above is the latest).RunAs Set appears to work as it is *not* returning 0 (fail) otherwise msgbox.The account credentials I am using are correct as I can log into the box with them. I can run the compiled script fine logged in as a user with admin rights so as far as I can tell that part is working fine. It's just when the script is run under a user account without admin privs that I'm getting back an AutoIT error on the RUN line that indicates that something to the effect of:"invalid username or bad password"What am I missing or doing wrong???OS of target machine=Win2K ProOS of my machine=WinXP ProAutoIT= 3.1.1 and 3.1.1.75 beta Edited October 6, 2005 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
LxP Posted October 7, 2005 Share Posted October 7, 2005 According to the help file, RunAsSet() returns 1 regardless of success or failure:Return ValueReturns 1--regardless of success. (If the login information was invalid, subsequent Run/RunWait commands will fail....)Returns 0 if the operating system does not support this function.Also:The "Secondary Logon service" or "RunAs service" must not be disabled if you want this function to work. Link to comment Share on other sites More sharing options...
Skruge Posted October 7, 2005 Share Posted October 7, 2005 Also, you may want to turn off RunErrorsFatal so your script can handle any failures.Opt("RunErrorsFatal", 0) ;1=fatal, 0=silent set @error [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
/dev/null Posted October 8, 2005 Share Posted October 8, 2005 (edited) According to the help file, RunAsSet() returns 1 regardless of success or failure:Also:only for Win 95/98/ME, as there exists no real user concept!From Help file:RemarksThis function will always return 1 under Window 95/98/Me.CheersKurtWhat am I missing or doing wrong???Two questions that might solve your problem...1.) Is h:\ a local drive or a network file share?2.) Is Administrator your local account or domain account?CheersKurt Edited October 8, 2005 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
sshrum Posted October 8, 2005 Author Share Posted October 8, 2005 (edited) 1) H: is a network share 2) Admin is local account Hmmm...you might have something there. While the domain user has access to the H: drive but no install privs, the local admin account has privs to install but *may not have* access privs to the H: domain network drive. I'll need to test that on Monday. Edited October 8, 2005 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
/dev/null Posted October 9, 2005 Share Posted October 9, 2005 While the domain user has access to the H: drive but no install privs, the local admin account has privs to install but *may not have* access privs to the H: domain network drive. I'll need to test that on Monday.I guess, that's exactly your problem.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * 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