Jump to content

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


Dave70
 Share

Recommended Posts

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

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
Link to comment
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]

Link to comment
Share on other sites

  • Developers

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

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.

Link to comment
Share on other sites

  • Developers

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

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

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

Link to comment
Share on other sites

  • Developers

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

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

  • 5 months later...

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?

Link to comment
Share on other sites

  • Developers

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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...