Chinaunix首页 | 论坛 | 博客
  • 博客访问: 189972
  • 博文数量: 49
  • 博客积分: 1061
  • 博客等级: 少尉
  • 技术积分: 635
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-21 08:42
文章分类

全部博文(49)

文章存档

2015年(1)

2014年(2)

2013年(1)

2012年(45)

分类: IT业界

2012-01-08 12:36:19

从网上找了个脚本,自动添加tsmmc的远程桌面列表,但是里面没有域那一项,手动改了下,却发现,偶尔可以执行成功,很多时候执行不了,也没有错误提示。代码如下:

CODE:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.run("%SystemRoot%\system32\tsmmc.msc /s")
WScript.Sleep 2000

Dim ip(100)
'ip(0)=Array("服务器远程桌面IP","服务器远程桌面用户名","服务器远程桌面密码","服务器远程桌面网域")
ip(0)=Array("192.168.100.6","administrator","abc123","domain")
ip(1)=Array("192.168.100.7","administrator","abc123","domain")
ip(2)=Array("192.168.100.11","administrator","abc123","domain")
ip(3)=Array("192.168.100.16","administrator","abc123","domain")
ip(4)=Array("192.168.100.17","administrator","abc123","domain")
ip(5)=Array("192.168.100.18","administrator","abc123","domain")
ip(6)=Array("192.168.100.19","administrator","abc123","domain")
ip(7)=Array("192.168.100.20","administrator","abc123","domain")
ip(8)=Array("192.168.100.21","administrator","abc123","domain")
ip(9)=Array("192.168.100.31","administrator","abc123","domain")
ip(10)=Array("192.168.100.32","administrator","abc123","domain")
ip(11)=Array("192.168.100.34","administrator","abc123","domain")
ip(12)=Array("192.168.100.60","administrator","abc123","domain")
ip(13)=Array("192.168.100.66","administrator","abc123","domain")
ip(14)=Array("192.168.100.85","administrator","abc123","domain")
ip(15)=Array("192.168.100.100","administrator","abc123","domain")
ip(16)=Array("192.168.100.101","administrator","abc123","domain")
ip(17)=Array("192.168.3.150","administrator","abc123","domain")
ip(18)=Array("192.168.100.189","administrator","abc123","domain")
ip(19)=Array("192.168.3.190","administrator","abc123","domain")
ip(20)=Array("192.168.3.191","administrator","abc123","domain")
ip(21)=Array("192.168.100.210","administrator","abc123","domain")
ip(22)=Array("192.168.100.238","administrator","abc123","domain")
ip(23)=Array("192.168.3.100","administrator","abc123","domain")


For i=0 To 23
WshShell.SendKeys "+{F10}"
WshShell.SendKeys "A"
WshShell.SendKeys ip(i)(0)
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys ip(i)(1)
WshShell.SendKeys "{TAB}"
WshShell.SendKeys ip(i)(2)
WshShell.SendKeys "{TAB}"
WshShell.SendKeys ip(i)(3)
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ }"
WshShell.SendKeys "{ENTER}"
Next 在网上找到的源码如下:

CODE:

1. '/*=========================================================================
2. ' * Intro 解决win2003远程桌面连接多台服务器时,重做系统后还得一个一个得加半天。效率非常低的问题
3. ' * FileName 批量添加远程桌面.vbs
4. ' * Author yongfa365
5. ' * Version v1.0
6. ' * WEB
7. ' * Email yongfa365[at]qq.com
8. ' * FirstWrite /Item/PiLiangTianJiaYuanChengZhuoMian.vbs.html
9. ' * MadeTime 2007-11-29 00:46:30
10. ' * LastModify 2007-11-29 00:46:30
11. ' *==========================================================================*/
12.
13. Set WshShell = WScript.CreateObject("WScript.Shell")
14. WshShell.run("%SystemRoot%\system32\tsmmc.msc /s")
15. WScript.Sleep 3000
16.
17. Dim ip(100)
18. 'ip(0)=Array("服务器远程桌面IP","服务器远程桌面用户名","服务器远程桌面密码")
19. ip(0)=Array("100.110.111.112","UserName0","PassWord0")
20. ip(1)=Array("111.222.111.121:3389","UserName1","PassWord1")
21. ip(2)=Array("111.222.111.211:1234","UserName2","PassWord2")
22. ip(3)=Array("111.222.111.222","UserName3","PassWord3")
23.
24. For i=0 To 3
25. WshShell.SendKeys "+{F10}"
26. WshShell.SendKeys "A"
27. WshShell.SendKeys ip(i)(0)
28. WshShell.SendKeys "{TAB}"
29. WshShell.SendKeys "{TAB}"
30. WshShell.SendKeys "{TAB}"
31. WshShell.SendKeys "{TAB}"
32. WshShell.SendKeys ip(i)(1)
33. WshShell.SendKeys "{TAB}"
34. WshShell.SendKeys ip(i)(2)
35. WshShell.SendKeys "{ENTER}"
36. Next 哪位朋友能告诉我,问题出在哪里?
阅读(912) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~