Dave70 Posted January 15, 2010 Share Posted January 15, 2010 Hi all,I have recently moved to the latest version of AutoIt, and I see that "RunAsSet" is now history, and I am wondering how I can still do multipal tasks with a limited user logged on, and use the Administrator creditals? I have provided a small sample of what I used to do. RunAsSet("Administrator", @Computername, "password") SplashTextOn ( @ScriptName, @LF & 'Applying fix, please wait...', 350, 70, -1, -1, -1, "Times New Roman", 12 ) FileMove("C:\Documents and Settings\Administrator\NTUSER.DAT", "C:\Documents and Settings\Administrator\NTUSER.DAT.old") FileCopy ("C:\Program Files\Microsoft Office\Office10\ACCWIZ.DLL", "C:\Windows\system32\", 1) RegWrite ('HKEY_LOCAL_MACHINE\' & 'Software\Microsoft\Shared Tools\Proofing Tools\Custom Dictionaries', '1', 'REG_SZ', 'D:\USERDATA\' & @UserName & '\Application Data\Microsoft\Proof\custom.dic') RunAsSet() SplashOff () MsgBox (0, @ScriptName, 'Fix has been applied.', 15)Working on the understanding that "RunAs", only works by calling external exe's, bat's etc I am stugglying with what to do now... I can already hear some of you saying go back to the old version, but i would like to keep moving forward with the new version of AutoIT.Any help greatly appreciated. Link to comment Share on other sites More sharing options...
FuryCell Posted January 15, 2010 Share Posted January 15, 2010 You could use RunAs and @ScriptFullPath to launch the script with different credentials. HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
leonick5 Posted January 15, 2010 Share Posted January 15, 2010 (edited) Not an expert in this matter, and I never used RunAsSet. But If I understood it correctly, then RunAsSet gives your script other rights.(e.g.admin) If its true then you could use RunAs to run another script, with admin rights. Edited January 15, 2010 by leonick5 Link to comment Share on other sites More sharing options...
Dave70 Posted January 15, 2010 Author Share Posted January 15, 2010 P5ych0Gigabyte, if you are meaning calling a second script from the first script which contains "RunAs"... then I did consider that, but that seems so messy to me. Link to comment Share on other sites More sharing options...
leonick5 Posted January 15, 2010 Share Posted January 15, 2010 Messy? What do you mean by messy? Link to comment Share on other sites More sharing options...
Dave70 Posted January 15, 2010 Author Share Posted January 15, 2010 Messy... in my mind, all be it limited to scripting, using one script to call another for a handful of commands/tasks seems a bit... well unnecessary. Especially given the older version of AutoIt, did it beautifully. Link to comment Share on other sites More sharing options...
leonick5 Posted January 15, 2010 Share Posted January 15, 2010 (edited) Should be no problem,..since its meant to be like that now I think. Here is another good topic about it http://www.autoit.de/index.php?page=Thread&postID=46623 Edited January 15, 2010 by leonick5 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 15, 2010 Share Posted January 15, 2010 P5ych0Gigabyte, if you are meaning calling a second script from the first script which contains "RunAs"... then I did consider that, but that seems so messy to me. You could just RunAs() the first script again, there's no need for a second. [pseudo-code] If Admin DoStuff() Exit IfEnd ;Rest of script [/pseudo-code] .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Juvigy Posted January 15, 2010 Share Posted January 15, 2010 You can move to the old version if you want to use RunAsSet. Also i think there was some examples using winApi and DLL calls that implemented the functionality of RunAsSet.Search the forum. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 15, 2010 Developers Share Posted January 15, 2010 Messy... in my mind, all be it limited to scripting, using one script to call another for a handful of commands/tasks seems a bit... well unnecessary. Especially given the older version of AutoIt, did it beautifully.What in your mind did RunAsSet() & Run() do different from RunAs()? 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. Link to comment Share on other sites More sharing options...
Dave70 Posted January 17, 2010 Author Share Posted January 17, 2010 What in your mind did RunAsSet() & Run() do different from RunAs()? JosIn the old version RunAsSet() ran the subsequent lines of code within the same file with the designated creditals used in the RunAsSet() command, where by I understand it RunAs() only makes single line calls to external exe's, bat's extra... by all means corrected me if I am wrong, or provided some examples to help.Thank you. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 17, 2010 Developers Share Posted January 17, 2010 (edited) In the old version RunAsSet() ran the subsequent lines of code within the same file with the designated creditals used in the RunAsSet() command, where by I understand it RunAs() only makes single line calls to external exe's, bat's extra... by all means corrected me if I am wrong, or provided some examples to help.Thank you.This is what i thought you were thinking but this is not the case. The only thing RunAsSet() did was changing the credentials of subsequent Rn() and RunWait() functions....nothing else. So the only thing happened is that Run() and RunAsSet() are combined into one statement RunAs().Jos Edited January 17, 2010 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. Link to comment Share on other sites More sharing options...
Dave70 Posted January 17, 2010 Author Share Posted January 17, 2010 This is what i thought you were thinking but this is not the can. The only think RunAsSet() did was changing the credentials of subsequent Rn() and RunWait() functions....nothing else. So the only thing happened is that Run() and RunAsSet() are combined into one statement RunAs().JosOh ok... I thought it also apply that same set of creditals to subsequent commands like, RegWrite, FileOpen etc etc. Oh well I get i just have to move with the times, and learn the new command and run with a second file.Thanks to all who replied.David Link to comment Share on other sites More sharing options...
Developers Jos Posted January 17, 2010 Developers Share Posted January 17, 2010 Oh ok... I thought it also apply that same set of creditals to subsequent commands like, RegWrite, FileOpen etc etc. Oh well I get i just have to move with the times, and learn the new command and run with a second file.Thanks to all who replied.DavidThis was a common mistake made and one of the reasons to make the change to one command.What I normally do for this is to have the script execute itself with admin credentials.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. Link to comment Share on other sites More sharing options...
vrocco Posted July 17, 2010 Share Posted July 17, 2010 This was a common mistake made and one of the reasons to make the change to one command.What I normally do for this is to have the script execute itself with admin credentials.JosSorry to dig up an old post, but I took some time off from Autoit and was also wondering what happened to this command.I hate to argue with a developer, but the above doesn't make any sense. I could put RunAsSet at the beginning of a script and a limited user account running the script could edit the registry, work with files and folder they don't have access to, etc. So it would seem it applied the credentials to everything within the script. RunAs doesn't do this.How do I go about making the script execute as admin? I mean having a limited user run the script without the admin password? Link to comment Share on other sites More sharing options...
Developers Jos Posted July 17, 2010 Developers Share Posted July 17, 2010 I hate to argue with a developer, but the above doesn't make any sense. I could put RunAsSet at the beginning of a script and a limited user account running the script could edit the registry, work with files and folder they don't have access to, etc. So it would seem it applied the credentials to everything within the script. RunAs doesn't do this.RunAsSet() did not change the credentials of the running script! It would only set the credentials for subsequent Run() and RunWait() commands.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. Link to comment Share on other sites More sharing options...
vrocco Posted July 19, 2010 Share Posted July 19, 2010 Hmmm....I can't really explain how my limited users were able to edit the registry by running a script then. I didn't run regedit as admin, I simply put RunAsSet at the beginning and used the Autoit registry command set. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 19, 2010 Developers Share Posted July 19, 2010 I guess they do have write access to those registry keys 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...
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