Jump to content

Recommended Posts

Posted

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)

  • 2 weeks later...
Posted

Try this

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

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

Posted

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

Posted

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

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
×
×
  • Create New...