首页 > Web开发 > 详细

PowerShell小技巧之启动远程桌面连接

时间:2016-02-04 14:07:58      阅读:189      评论:0      收藏:0      [点我收藏+]

以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

PowerShell小技巧之启动远程桌面连接

原文:http://www.jb51.net/article/55036.htm

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!