windows powershell

How to remotely enable Remote Desktop (RDP) using PowerShell


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

You may also like:

Add Calendar Permissions in Office 365 via Powersh... This is a tutorial on how to add calendar permissions in Office 365 for your users via Powershell. You can add permissions onto a specific mailbox, or...
Removing Old and Unused Drivers from Driver Store ... Each time you install or update your device driver, Windows OS (since Vista) continues to store the old version of the driver in the system Driver Sto...
Windows Server 2008 – Multiple RDP Sessions In Windows Server 2008 and Windows Server 2008 R2, multiple remote desktop sessions is not configured by default. Multiple RDP Sessions Here is a qu...
How to copy files with BITS using PowerShell If you use local (and global) networks, you might know that files between systems are transferring by using SMB, FTP or HTTP protocols. The problem wi...
How to transfer FSMO Roles From a Failed Domain Co... In case domain controller, which owns FSMO (Flexible Single Master Operation) roles, is fail (virus attack, fatal software problems or catastrophic ha...

Add Your Comment