Jump to content
Sign in to follow this  
daslick

RunAs problem

Recommended Posts

daslick

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
DarkMatter

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
daslick

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
MHz

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
daslick

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  

×