Jump to content

RunAs problems


KoenG
 Share

Recommended Posts

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

Link to comment
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")

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...