vbs更改3389远程桌面端口的脚本
程序员文章站
2024-01-01 18:38:04
set wshshell=createobject("wscript.shell") function imput() imputport=inputb...
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
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