Archive for Windows Server

How to enable Remote Desktop remotely using Powershell

<#
How to enable Remote Desktop remotely using Powershell
In Windows Server 2012, remote management is enabled by default but not Remote Desktop. To enable RDP on the server, add the target server to the Server Manager and run remote Powershell console. The code here can you save as ps1 file and use as script
#>

<#On the remote Powershell console, enable remote desktop and firewall using the following cmdlets:
1) Enable Remote Desktop #>
set-ItemProperty -Path ‘HKLM:\System\CurrentControlSet\Control\Terminal Server’-name “fDenyTSConnections” -Value 0

<# 2) Allow incoming RDP on firewall #>
Enable-NetFirewallRule -DisplayGroup “Remote Desktop”

<#3) Enable secure RDP authentication #>
set-ItemProperty -Path ‘HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp’ -name “UserAuthentication” -Value 1