info@machineLOGIC.com
303.217.7001

Using PowerShell to Enable Remote Desktop

Posted by: Nathan Taylor
Category: Company News, Tech Advice

I had a computer that I needed to remote into. I didn’t have any of my normal remote access tools installed on it, so I needed to find another way into it remotely.

First I enabled PowerShell Remoting via Group Policy. This involved telling windows to start listening for PowerShell requests and defining which networks it would accept requests from. You also have to start a service and open some firewall ports. After you make these changes, you have to wait for group policy to update which can take a while. Here’s the article I followed:

http://www.grouppolicy.biz/2014/05/enable-winrm-via-group-policy/

Then I opened PowerShell ISE on one of the servers in the domain and ran this command to remote to the machine:

Enter-PSSession -ComputerName 10.10.0.15

 

Then I ran these commands:

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

 

From <http://networkerslog.blogspot.com/2013/09/how-to-enable-remote-desktop-remotely.html>

 

I then tried Remote Desktop and it worked! PowerShell for the win!

 

If you want more information about PowerShell, I recommend 2 great resources:

Learn PowerShell in a month of lunches by Don Jones:  http://morelunches.com/2012/11/01/learn-powershell-3-in-a-month-of-lunches-2nd-ed/

Microsoft Virtual Academy PowerShell 3.o jumpstart video: https://www.microsoftvirtualacademy.com/en-us/training-courses/getting-started-with-powershell-3-0-jump-start-8276

 

mm
Author: Nathan Taylor
Lead Engineer Nathan has been helping companies get the most value from their technology investments for over 10 years. He specializes in designing and maintaining Windows networks and working with various cloud technologies including Office 365 and Azure.