使用 VBscript / Wscript 进行 Telnet 重置

发布于 2024-12-29 02:55:03 字数 957 浏览 0 评论 0原文

此 VBSCRIPT 代码引发 800A0400 错误。有什么想法吗?

<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>

This VBSCRIPT code throws a 800A0400 error. Any thoughts?

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枯叶蝶 2025-01-05 02:55:03

您是否尝试过在 google 上查找您收到的错误代码或脚本文件 XML 语法?您缺少 根元素,并且文件扩展名可能错误(应为 .wsf)。

Have you tried to google for the error code you are getting or for script file XML syntax? You are missing <package> root element and probably you have wrong file name extension (should be .wsf).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文