Thursday, January 08, 2009

Remotely enable RDP

Have you ever been away from your work PC, tried to Remote Desktop (RDP/mstsc) into it, only to realize that you’ve forgotten to enable RDP before you left work?  Ever shake your head at the irony that if you could only remote in, you could enable RDP?

Well now you can:

Method 1

The simplest way is to run a free tool:

http://www.intelliadmin.com/blog/2006/06/remotely-enable-remote-desktop.html

Method 2

If you’d prefer to not run an unknown tool and give it admin access to your remote machine, you can do it by hand:

  1. Fire up regedit.exe on your local machine.
  2. File -> Connect Network Registry -> your remote machine name for which you have admin access.
  3. File -> Import… -> and import the following file:

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\FirewallRules]

    "RemoteDesktop-In-TCP"="v2.0|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Domain|Profile=Private|Profile=Public|LPort=3389|Name=@FirewallAPI.dll,-28753|Desc=@FirewallAPI.dll,-28756|EmbedCtxt=@FirewallAPI.dll,-28752|Edge=FALSE|"

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]

    "fDenyTSConnections"=dword:00000000

  4. Reboot your remote machine:
    shutdown \\yourremotemachine /f /r /t 0
Method 3

If you can use WMI you can use the Win32_TerminalServiceSetting class in the root\cimv2\TerminalServices namespace. The SetAllowTSConnections method will allow you to enable the ts connections. You will need to set both the AllowTSConnections and the ModifyFirewallException params to 1.

http://msdn.microsoft.com/en-us/library/aa383640(VS.85).aspx

I’m not sure how to use WMI myself.  If someone know how to please comment.

No comments:

Post a Comment