KoenG Posted November 17, 2008 Posted November 17, 2008 Hi, I need to RunAs a program with admin-rights, do a little manipulation and then exit the program. Can someone explain to me why the first example works, and the second does not? I have to use logon flag 0 or 1, I have learned from experience. All input welcome, Koen ; This works Run("notepad.exe") WinWaitActive("Untitled - Notepad","", 1) Send("This is a test") Sleep(1000) WinClose("Untitled - Notepad") WinWaitActive("Notepad","", 1) Send("!N") ;This doesn't work RunAs("Admin_Account", "Domain_name", "Admin_Pass",0,"notepad.exe") WinWaitActive("Untitled - Notepad","", 1) Send("This is a test") Sleep(1000) WinClose("Untitled - Notepad") WinWaitActive("Notepad","", 1) Send("!N") Exit
Juvigy Posted November 17, 2008 Posted November 17, 2008 Try this out : RunAs($user, $domain, $pass,0,@ScriptName,@ScriptDir) Run("notepad.exe") WinWaitActive("Untitled - Notepad","", 1) Send("This is a test") Sleep(1000) WinClose("Untitled - Notepad") WinWaitActive("Notepad","", 1) Send("!N")
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