Friday, 28 October 2011

Runas VBS script

Let me start by saying that by no means im a scripting guy this is more for my own needs. copy all the below test in to notepad and save as a VBS.

Option explicit
Dim oShell
set oShell= Wscript.CreateObject("WScript.Shell")
oShell.Run "RunAs /noprofile /user:domain\administrator ""c:\path\to\prog.exe""",2 "use the ,2 to minimize the DOS box that will run your program"
WScript.Sleep 500
oShell.Sendkeys "PASSWORD~" "remember to keep the ~ as this sends an enter after your password"

No comments:

Post a Comment