There are multiple ways to enable Remote Desktop (RDP) so I will try to cover all of them and also to provide a script to enable it remotely, without too much work.
Ways to enable RDP:
- Start – control panel – system – remote – activate the “allow users to connect remotely to this computer” check-box (you can also do this by right clicking my computer on your desktop and selecting properties – this is the equivalent of the start – control panel – system). One more thing to know here, is that after you check the check-box to enable RDP, you have another button called “select remote users”. This button can be of use if you want to add user-names to be allowed to connect remotely, others than administrators of this computer. Administrators group is added by default so, if the user you want to allow to use RDP is added to administrators group, you don’t need to add him with this button but, if he is not an administrator, you must add him with his user-name or another group if he belongs to such a thing. This button is the equivalent to this method: if you type “compmgmt.msc” at start – run, and press enter, then navigate to local users and groups – groups – double click “remote desktop users” group, you would see the same people added with that button, this is how I like to call it: the technical approach…I don’t like buttons, they are too easy.
Now if you ask what does really happen in the background when you click that check-box or uncheck it for the “allow users to connect remotely to this computer” I would show you a key in the registry that changes the value depending on the case. So for example, if we select the check-box to enable the option to allow users with rights for this, to connect remotely to this computer, following this path in registry “\HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\TERMINAL SERVER” you would find that the DWORD fDenyTSConnections changes its value from 1 to 0. Now if you do the backwards of this and disable the check-box to allow users to connect to this PC, the value of the same registry key would change from 0 to 1, and it would forbid users to connect remotely anymore.
Based on the second way of enabling RDP, I’ve found the following VB Script and the only thing you have to do is to copy/paste the code into a .vbs file extension for example RDP.vbs and run it when you need it:
Set oFS = CreateObject(“Scripting.FileSystemObject”)
Set Shell = CreateObject(“WScript.Shell”)
COMP = InputBox (“Computername or IP”,”Enable RD:”,”PC_NAME”)
if COMP <> vbnullstring Then
If Not oFS.FolderExists(“\\” & COMP & “\c$”) Then
MsgBox “Cannot access ” & COMP & “!”
Shell.Run “reg add \\” & COMP & “””\HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\TERMINAL SERVER”” /v fDenyTSConnections /t REG_DWORD /d 0 /f”,0
End ifmsgbox “Now starting Remote Desktop Connection to ” & COMP
Shell.Run “mstsc /v:” & COMP
So your file before saving should look something like this:
Note: User will still need to have rights assigned to them, so the user still needs to be added to at least the RDP group for that computer.
In conclusion, I hope it will help you in whatever action you see fit the use of it.