2012-01-25 45 views
-2

此VBSCRIPT代碼會引發800A0400錯誤。有什麼想法嗎?使用VBscript/Wscript進行Telnet復位

<job> 
<script language="VBScript"> 
Option Explicit 
On Error Resume Next 
Dim WshShell 
set WshShell=CreateObject("WScript.Shell") 
WshShell.run "cmd.exe" 
WScript.Sleep 500 
'Send commands to the window as needed - IP and commands need to be customized 
'Step 1 - Telnet to remote IP' 
WshShell.SendKeys "telnet 123.456.789.01" 
WshShell.SendKeys ("{Enter}") 
WScript.Sleep 500 
'Step 2 - Issue Commands with pauses' 
'USERNAME 
WshShell.SendKeys "USERNAMEHERE" 
WshShell.SendKeys ("{Enter}") 
WScript.Sleep 500 
'PASSWORD 
WshShell.SendKeys "PASSWORDHERE" 
WshShell.SendKeys ("{Enter}") 
WScript.Sleep 500 
'RESET 
WshShell.SendKeys "reset" 
WshShell.SendKeys ("{Enter}") 
WScript.Sleep 500 
'CONFIRM 
WshShell.SendKeys "y" 
WshShell.SendKeys ("{Enter}") 
WScript.Sleep 500 
'Step 3 - Exit Command Window 
WshShell.SendKeys "exit" 
WshShell.SendKeys ("{Enter}") 
WScript.Quit 
</script> 
</job> 

回答

1

您是否嘗試過谷歌搜索錯誤代碼或腳本文件XML語法?您缺少<package>根元素,可能您的文件擴展名錯誤(應該是.wsf)。