VBS Script – Remotely Enable Remote Desktop

The following script can be used to remotely enable the remote desktop service on Windows XP

strComputer = InputBox ("Enter Machine Name")

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colTSSettings = objWMIService.InstancesOf("Win32_TerminalServiceSetting")

For Each colTS in colTSSettings
colTS.SetAllowTSConnections(1)
Wscript.Echo UCase(strComputer) & " Remote Desktop Is Now Enabled"
Next