Although the Remote Management is enabled by default starting with Windows Server 2012, the RDP access isn’t. To enable RDP with Powershell, you have two steps to perform: Enable the RDP Access Enable the inbound firewall rules Here’s the code:
|
# 1. Enable Remote Desktop (Get-WmiObject Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).SetAllowTsConnections(1,1) (Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\TerminalServices -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0) # 2. Enable the firewall rule Enable-NetFirewallRule -DisplayGroup "Remote Desktop" |
The second line allows you to specify if you […]