Enable Remote Desktop Through a Script
Being a huge Group Policy guy I have always searched for a policy that would allow me to turn on or off Remote Desktop on clients and servers. Well there is no Group Policy that currently does that. I do however have VB script that can be used to enable Remote Desktop on Windows 2000, XP, and Server 2003 and then of course pushed out via Remote Desktop.
To use copy the code below and paste into a file with a text file with a .vbs extension. This will work for the local machine. Just replace the perion part that is mentioned in this string to another computer name if you want have it work on one machine - strComputer - "."
Const ENABLE_CONNECTIONS = 1
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_TerminalServiceSetting")
For Each objItem in colItems
errResult = objItem.SetAllowTSConnections(ENABLE_CONNECTIONS)
Next
By the way if you want to turn off Remote Desktop just change the 1 in this line of code
Const ENABLE_CONNECTIONS = 1
to a 0.