If you want to remotely enable Remote Desktop (RDP) on the server, but you have not access to the terminal, we will show you how to do it by using Powershell. In our case we are usingserver on 2012 R2 platform. It should be noted that Windows Server 2012 R2 already has PowerShell, so we can easily use some scripts to solve this problem.
Enable RDP Remotely Using PowerShell
First of all we need to establish a session with the remote server. To do this just use the command:
Enter-PSSession -ComputerName server.domain.local -Credential domain\administrator
Now we need to actually enable Remote Desktop.
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0
Once it is done, activate the firewall rule.
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
After that you should enable authentication via RDP.
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1