wking10 Posted June 20, 2008 Share Posted June 20, 2008 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) Link to comment Share on other sites More sharing options...
Micha1405 Posted June 20, 2008 Share Posted June 20, 2008 (edited) Try this RunAsWait ($UserName,$DomainName,$Password, 0, $RunProgram ) Edited June 20, 2008 by Micha1405 My TrayToolBar Link to comment Share on other sites More sharing options...
wking10 Posted June 29, 2008 Author Share Posted June 29, 2008 Try thisRunAsWait ($UserName,$DomainName,$Password, 0, $RunProgram )no it stil doesn't work. is there really any way at all? Link to comment Share on other sites More sharing options...
Valik Posted June 29, 2008 Share Posted June 29, 2008 I suggest you learn to read the documentation that comes with AutoIt. This has nothing to do with RunAs() at all. Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 30, 2008 Share Posted June 30, 2008 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now