Sign in to follow this  
Followers 0
KoenG

RunAs problems

3 posts in this topic

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

Share this post


Link to post
Share on other sites



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")

Share this post


Link to post
Share on other sites

Great! Thank you very much.

Koen

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