Sign in to follow this  
Followers 0
Dave70

No "RunAsSet" anymore... now what. :(

18 posts in this topic

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.

Share this post


Link to post
Share on other sites



#3 ·  Posted (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 by leonick5

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Messy? What do you mean by messy?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by leonick5

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

What in your mind did RunAsSet() & Run() do different from RunAs()?

Jos

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.

Share this post


Link to post
Share on other sites

#12 ·  Posted (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 by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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().

Jos

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.

David

Share this post


Link to post
Share on other sites

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.

David

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.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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.

Jos

Sorry 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?

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0