I have a [VBScript](http://en.wikipedia.org/wiki/VBScript) script that starts a cmd prompt, telnets into a device and [TFTP](http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol)'s the configuration to a server. It works when I am logged in and run it manually. I would like to automate it with Windows [Task Scheduler](http://en.wikipedia.org/wiki/Task_Scheduler).

Any assistance would be appreciated, here is the VBScript script:

```
set WshShell = WScript.CreateObject("WScript.Shell") 
WshShell.Run "cmd" 
WScript.Sleep 100 
WshShell.AppActivate "C:\Windows\system32\cmd.exe" 
WScript.Sleep 300 
WshShell.SendKeys "telnet 10.20.70.254{ENTER}" 
WScript.Sleep 300 
WshShell.SendKeys "netscreen" 
WScript.Sleep 300 
WshShell.SendKeys "{ENTER}" 
WScript.Sleep 300
WshShell.SendKeys "netscreen" 
WshShell.SendKeys "{ENTER}" 
WScript.Sleep 300 
WScript.Sleep 300 
WshShell.SendKeys "save conf to tftp 10.10.40.139 test.cfg{ENTER}"
WScript.Sleep 200 
WshShell.SendKeys "exit{ENTER}" 'close telnet session' 
set WshShell = WScript.CreateObject("WScript.Shell") 
WshShell.Run "cmd" 
WScript.Sleep 100 
WshShell.AppActivate "C:\Windows\system32\cmd.exe" 
WScript.Sleep 300 
WshShell.SendKeys "telnet 10.20.70.254{ENTER}" 
WScript.Sleep 300 
WshShell.SendKeys "netscreen" 
WScript.Sleep 300 
WshShell.SendKeys "{ENTER}" 
WScript.Sleep 300
WshShell.SendKeys "netscreen" 
WshShell.SendKeys "{ENTER}" 
WScript.Sleep 300 
WScript.Sleep 300 
WshShell.SendKeys "save conf to tftp 10.10.40.139 palsg140.cfg{ENTER}" 'repeat as needed 
WScript.Sleep 200 
WshShell.SendKeys "exit{ENTER}" 'close telnet session' 
WshShell.SendKeys "{ENTER}" 'get command prompt back 
WScript.Sleep 200 
WshShell.SendKeys "exit{ENTER}" 'close cmd.exe

WshShell.SendKeys "{ENTER}" 'get command prompt back 
WScript.Sleep 200 
WshShell.SendKeys "exit{ENTER}" 'close cmd.exe

```