VBS修改远程桌面的默认端口

    本文地址:http://tongxinmao.com/Article/Detail/id/27

    '#####################
    'VBS修改远程桌面的默认端口,并添加至Windows防火墙
    '作者51windows.Net
    '3388为要设置的端口
    '#####################
    
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber",3388,"REG_DWORD"
    WshShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp\PortNumber",3388,"REG_DWORD"
    
    
    Function Addfirewall(name,port,state)
     Set objFirewall = CreateObject("HNetCfg.FwMgr")
     Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
     
     Set objPort = CreateObject("HNetCfg.FwOpenPort")
     objPort.Port = port
     objPort.Name = name
     objPort.Enabled = state
     Set colPorts = objPolicy.GloballyOpenPorts
     errReturn = colPorts.Add(objPort)
    End Function
    
    call Addfirewall("远程桌面3388",3388,1)
    set WshShell = nothing
    
    msgbox "设置成功"


    上一篇:移动联通电信运营商手机号段分配
    下一篇:PHP资源汇总,内容包括:库、框架、模板等