Submitted By: Francisco

Enables automated password entry for the RunAs command.

Visual Basic
Edit|Remove
set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.run "runas /user:domain\user %comspec%" 'Open command prompt 
WScript.Sleep 1000
WshShell.SendKeys "password" 'send password  
WshShell.SendKeys "{ENTER}"   
WScript.Sleep 1000

'Open IE
WshShell.SendKeys Chr(34) + "C:\PROGRAM FILES\INTERNET EXPLORER\IEXPLORE.EXE" + Chr(34)
WshShell.SendKeys "{ENTER}"

WshShell.SendKeys "exit"  'Close command prompt
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000

WshShell.SendKeys "{TAB}"
WshShell.SendKeys "http://www.microsoft.com" 'Send internet page to open to IE
WshShell.SendKeys "{ENTER}"

set wshshell = nothing