Quantcast
Channel: Powershell – TheITBros
Viewing all articles
Browse latest Browse all 91

How to remotely enable Remote Desktop using PowerShell

$
0
0
windows powershell

If you want to remotely enable Remote Desktop on the server, but you have not access to the terminal, we will show you how to do it. In our case we are using on server 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.

First of all we need to establish a session with the remote server. Just use this 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

The post How to remotely enable Remote Desktop using PowerShell appeared first on TheITBros.


Viewing all articles
Browse latest Browse all 91

Trending Articles