Archive for juillet 2010

Enable or disable remote desktop on a Windows Server

Being able to remotely enable or disable remote desktop can be a real lifesaver.

Perhaps the server has stopped accepting connections. Sometimes, turning remote desktop off and back on again can help. Or perhaps you shipped a server to a client but forgot to enable remote desktop before sending it out the door.

 
 

If you find yourself facing either of these situations, and you don’t have console access, a network-attached KVM, or someone local to the server console, then this tip can help.

 
 

Remote desktop for Windows Servers can be set through the registry. Remote access of the Windows registry is enabled by default (when Firewall is disabled), and remote desktop can be disabled or enabled.

As always, remember to make a reliable backup of your Registry before performing this edit. Also, you must make the edit on an account that’s a member of the local Administrators group.

 
 

Here is how to edit the Registry to enable remote desktop:

 
 

  • Open the Registry Editor, click File and select Connect Network Registry. When the Select Computer window appears, navigate to the server on which you re making the edit and click OK.
  • Once the machine’s registry is open, navigate to:

         HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\fDenyTSConnections

  • This value is set to 1 by default, which is the value to disable remote desktop. To enable remote desktop, double-click the registry key and set the value to 0.
  • Once you’ve made the Registry edit to enable remote desktop, you’ll need to reboot the server in order for it to take effect.

 
 

There are two ways to do this remotely:

 
 

First, from a command prompt, enter:

 shutdown /r /m \\SERVERNAME /f /t 10

 The /t and number 10 at the end will add a 10-second delay to the process.

 
 

You can also use the following in a PowerShell file:

 Start-Sleep 10

Restart-Computer -Force -SERVERNAME

 
 

After the reboot, remote desktop should work.