| Subcribe via RSS

VBS-更改mstsc端口

七月 23rd, 2008 Posted in 3.开发, VBS < by John.Lv >

Set WshShell=CreateObject(”Wscript.Shell”)
Function Imput()

‘定义更改端口输入框
imputport=InputBox(”请输入一个端口号,注意:这个端口号目前不能被其它程序使用,否则会影响终端服务”,” 更改终端端口号”, “3389″, 100, 100)
If imputport<>”" Then ‘判断不为空
If IsNumeric(imputport) Then ‘判断输入端口为数字

‘更改注册表

WshShell.RegWrite “HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp\PortNumber”,imputport,”REG_DWORD”
WshShell.RegWrite “HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber”,imputport,”REG_DWORD”
wscript.echo “操作成功”
Else wscript.echo “输入出错,请重新输入”
Imput()
End If
Else wscript.echo “操作已经取消”
End If
End Function
Imput()
set WshShell=nothing

2 Responses to “VBS-更改mstsc端口”

  1. 3ice Says:

    JOHN 是什么人?难道还没找到工作么。。。汗


  2. Michael Field Says:

    呵呵 也是我们的以前的同事,只是现在都不在一个公司啦。


Leave a Reply