Question
August 14, 2007 at 02:26 AM
mdegroodt

VBS script failure

by mdegroodt . Updated 19 years, 2 months ago

I got a Vbs login script i want to use to execute commands in cmd with admin privileges. It sometimes fails to load properly and hangs at “enter the administrator password” and doesnt send the password while sometimes it works perfectly.
Can anyone see what i have to change or do?

Option explicit
Dim oShell
set oShell= Wscript.CreateObject(“WScript.Shell”)
oShell.Run “runas /noprofile /user:Administrator@Domainnamehere “”C:\windows\system32\cmd.exe”””
WScript.Sleep 100
oShell.Sendkeys “Somepasswordhere~”
WScript.Sleep 100
oShell.Sendkeys “route add 172.2.55.27 mask 255.255.255.255 172.22.45.26 /p~”
WScript.Sleep 100
oShell.Sendkeys “exit~”
Wscript.Quit

This discussion is locked

All Comments