Sign in to follow this  
Followers 0
wking10

problem with RUNAS

5 posts in this topic

Hi,

I am new to AutoIT script and been scratching my head around to get this simple script works.

What i want to do is to use RunAs to open a snap-in (.msc)

The following lines worked ok if i run some programs such as notepad.exe, eventvwr.exe, but as soon as i changed $RunProgram to run "console1.msc", or only "services.msc" it didn't work. What i hate was i have no idea how to track error/debug. nothing happened, no error whatsoever, but the program won't open.

i tried to call this .msc from a .bat, and then use AutoIT to execute the .bat, but the same nothing happened.

(the program i tried to run and the .au3 file are on the same folder)

I used Runas and RunAsWait, with all same result.

please help.

Dim $UserName, $DomainName, $Password, $RunProgram

$UserName = "xxxx"

$DomainName = "xxxx"

$Password = "xxxx"

$RunProgram = "test.bat"

RunAsWait($UserName,$DomainName,$Password,"",$RunProgram)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this

RunAsWait ($UserName,$DomainName,$Password, 0, $RunProgram )

Edited by Micha1405

Share this post


Link to post
Share on other sites

Try this

RunAsWait ($UserName,$DomainName,$Password, 0, $RunProgram )

no it stil doesn't work. is there really any way at all?

Share this post


Link to post
Share on other sites

I suggest you learn to read the documentation that comes with AutoIt. This has nothing to do with RunAs() at all.

Share this post


Link to post
Share on other sites

You can't run an .msc file directly. Run MMC.exe instead with the full path to your .msc as a parameter in the commandline:

RunAsWait('UserName', @ComputerName, 'Password', 0, 'mmc.exe "' & @SystemDir & '\services.msc"')

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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