您现在的位置是:网站首页> 编程资料编程资料
PowerShell小技巧之启动远程桌面连接_PowerShell_
2023-05-26
352人已围观
简介 PowerShell小技巧之启动远程桌面连接_PowerShell_
以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
您可能感兴趣的文章:
相关内容
- Windows Powershell 创建数组_PowerShell_
- Windows Powershell 命令返回数组_PowerShell_
- Windows Powershell 变量的幕后管理_PowerShell_
- Windows Powershell 变量的类型和强类型_PowerShell_
- Windows Powershell 变量的作用域_PowerShell_
- Windows Powershell 环境变量_PowerShell_
- Windows Powershell 自动化变量_PowerShell_
- Windows Powershell 定义变量_PowerShell_
- Powershell小技巧之使用Get-ChildItem得到指定扩展名文件_PowerShell_
- Powershell小技巧之通过EventLog查看近期电脑开机和关机时间_PowerShell_
