Using PowerShell to Enable Remote Desktop
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:
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
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