Sign in to follow this  
Followers 0
daslick

RunAs problem

7 posts in this topic

#1 ·  Posted (edited)

RunAs("test", @ComputerName, "admin", 0, @AutoItExe, @WorkingDir, @SW_SHOWDEFAULT)
RunAs("test", @ComputerName, "admin", 0, "notepad.exe", @WorkingDir, @SW_SHOWDEFAULT)

The first line does not work, but the second does.

I've tried using the older RunAsSet with Run, and I get an error that the directory name is invalid.

EDIT: I tested this line

RunAs("test", @ComputerName, "admin", 0, "cmd /c pause|start " & @AutoItExe, @WorkingDir, @SW_SHOWDEFAULT)
And the command prompt said "Access is denied." Edited by daslick

Share this post


Link to post
Share on other sites



You are trying this with a compiled script ...right?

Try:

RunAs("test", @ComputerName, "admin", 0, @AutoItExe, "", @SW_SHOWDEFAULT)

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

You could also try something like this:

If Not IsAdmin() Then
    RunAsSet("USERNAME", @ComputerName, "PASSWORD")
    If @Compiled Then
        Run('"' & @ScriptFullPath & '"')
        Exit
    EndIf
EndIf

[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Share this post


Link to post
Share on other sites

Tested. With your code I'm getting an Autoit error

Line -1:

Error: Unable to execute the external program.

Access is denied.

Share this post


Link to post
Share on other sites

Tested. With your code I'm getting an Autoit error

You may need to set a working directory which is valid for access.

RunAs("test", @ComputerName, "admin", 0, '"' & @AutoItExe & '"', @TempDir, @SW_SHOWDEFAULT)

And some quotes may help as well.

:)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Has anyone else with Autoit Beta 3.2.11.4 tried this? None of the examples posted here are working for me.

EDIT: I STILL have been unable to find a way to have my script use a RunAs/RunAsSet+Run command on itself with this version of Autoit. Help??

Edited by daslick

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