windows powershell

How to remotely enable Remote Desktop using 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

You may also like:

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...
Grant Full Access to All Mailboxes in Exchange 200... This is a short tutorial on how to add full access to all mailboxes in Exchange 2007 and 2010 for a an additional user. This can come in handy when sa...
Add Calendar Permissions in Office 365 via Powersh... This is a tutorial on adding calendar permissions in Office 365 for your users via Powershell. You can add permissions onto a specific mailbox, or you...
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 Reset Windows 10 Firewall Settings to Defau... Built-in Windows Firewall is an important part of all versions of Windows operating system (starting from Windows XP SP2) and, when properly configure...
READ ALSO  How to Disable Bing in the Windows 10 Start Menu