jkunkel Posted September 2, 2009 Share Posted September 2, 2009 I have read and experimented all afternoon to try to make this work. No luck. I have a script that calls a RunAs to an admin account and is supposed to kick off an install script. Works lovely under XP. We have skipped Vista. 7 is coming so I am working on getting my scripts ready. The RunAs just gets ignored in the script if it is calling my setup.exe file. I am 99% sure this is the UAC. I have thrown the #RequireAdmin at the top, but all that does is ask the users to login with admin rights, which negates the whole reason I am trying to wrap up the login RunAs in the first place. What am I doing wrong here? Why won't the RunAs throw up the UAC prompt on its own? I've tried RunAsWait as well. Here's a chunk of the code... Local $TxtFileName $TxtFileName = "C:\Software\software.txt" If FileExists($TxtFileName) Then Else Local $ProgramFile, $argFile, $command $ProgramFile = FileGetShortName("\\network path\setup.exe") $argFile = FileGetShortName("\\network path\settings.ini") $command = $ProgramFile & " /qb /I " & $argFile RunAs("admin", "domain", "adminpass", 0, $command) FileOpen($TxtFileName, 1) FileWriteLine($TxtFileName, "Software installed.") FileClose($TxtFileName) End If The text file gets written every time. RunAs is just majorly confusing to me right now. Any help would be much appreciated. Thanks! Link to comment Share on other sites More sharing options...
LarryDalooza Posted September 2, 2009 Share Posted September 2, 2009 It is likely your file operations may fail as a restricted user... try loading the profile with RunAs... logon_flag = 1 Lar. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
jkunkel Posted September 3, 2009 Author Share Posted September 3, 2009 Still no go. Changed the Logon_Flag, and I even added a working directory. It just doesn't launch the setup file. I feel like I'm missing something small. I can't be the only person trying to use this to launch an install file under admin credentials. Link to comment Share on other sites More sharing options...
2tim3_16 Posted December 23, 2009 Share Posted December 23, 2009 I can't be the only person trying to use this to launch an install file under admin credentials.You're not! I've been trying to figure this out ever since Vista Beta. Any answers? We use AutoIt for all the installs that we don't have MSIs for so can't use GP to push out. Link to comment Share on other sites More sharing options...
nergmlam Posted June 29, 2012 Share Posted June 29, 2012 HiTry with:$command = Chr(34) & $ProgramFile & " /qb /I " & $argFile & Chr(34) And please note that when using RunAs and RunAsWait you need to make sure, that the secondary logon service is running, and if you run your script from your own computer using e.g. pseexec.exe to get access to a remote computer, both computers must run the secondary logon service. And the secondary logon service needs the workstation service and netlogon service. The netlogon service only runs on domain computers, not on workgroup computers.You also needs to select a "@workingDir" for the functions, that the end user have write access to.SincerelyJorgen MalmgrenIT-ProgrammerDenmark - UTC+1www.tryware.dk;o) Your brain is like a parachute. It works best when it's Sincerely J. Malmgren IT-Programmer http://www.tryware.dk Link to comment Share on other sites More sharing options...
Valik Posted June 29, 2012 Share Posted June 29, 2012 Err, you just posted in a thread that is two and a half years old. /slowclap Also, why are you manually signing your posts? You'd think the forum had a signature feature or something, what with a lot of people having signatures and all. Posting it inline like that is just obnoxious and looks a lot like spam. Link to comment Share on other sites More sharing options...
nergmlam Posted June 29, 2012 Share Posted June 29, 2012 Hi Valik I just created my account today, and therefore I started to see what other users was having problem with. Yes jkunkels thread is old, but unresolved, and I though my comments could help him, and did hope, that he still had an email notification to his thread. And I did start examining properties of my account, but couldn't find anything about a default signature anywhere. But I can see, that you are using a signature. Where did you create that in your account properties. Sincerely J. Malmgren IT-Programmer http://www.tryware.dk 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