以Windows Server 2012 R2为例,其实非常简单。先启用远程连接:

(gwmi -class win32_terminalservicesetting -namespace "root\cimv2\terminalservices").setallowtsconnections(1)

然后再启用几条防火墙规则即可,用powershell(需要管理员权限)更显其威武:

PS> Get-NetFirewallRule -Name RemoteDesktop* | select DisplayName,Direction,Enabled 
DisplayName         Direction Enabled
-----------         --------- -------
远程桌面 - 用户模式(TCP-In)  Inbound  False
远程桌面 - 用户模式(UDP-In)  Inbound  False
远程桌面 - 远程监控(TCP-In)  Inbound  False

PS> Get-NetFirewallRule -Name RemoteDesktop* | Set-NetFirewallRule -Enabled true

您可能感兴趣的文章:

声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。