Enable Remote Desktop Connections from a Remote Location

If you dont have physical access to a PC or Server and you need to get remotely connected but the PC doesnt have the option to accept remote desktop connections, you can create a simple vbscript executable to do the trick. 

Copy the text below into a new text document.  Rename the file to .vbs  Run the file from the same network as the target system and be sure you are logged in with domain admin credentials.  You will be prompted to enter the PC name or IP address and thats it!

Code starts below this line =========================================


strComputer = InputBox(“Enter a computer name or IP:”,”RDP Remote Enable”)
If Len(strComputer) > 1 then
 Set objWMIService = GetObject(“winmgmts:” _
      & “{impersonationLevel=impersonate}\” & strComputer & “rootcimv2”)

 Set colItems = objWMIService.ExecQuery _
      (“Select * from Win32_TerminalServiceSetting”)

 For Each objItem in colItems
      errResult = objItem.SetAllowTSConnections(ENABLE_CONNECTIONS)
End If

Code ends above this line=========================================