Welcome to MSDN Blogs Sign in | Join | Help

Script to Enable Remote Desktop

Remote Desktop is disabled when installing Windows XP or Windows 2003. To enable this feature you can:

  • Use the UI. Right-Click on My Computer and select Properties. Enable Remote Desktop on the Remote Tab.
  • Use the simple script below

VBScript Example

'
' -------------------------------------------------
' Turns on Remote Desktop setting
'
' NOTE: Does not configure firewall
'

machine = "."
cimv2_string = "WINMGMTS:" & "\\" & machine & "\root\cimv2"
query = "select * from Win32_TerminalServiceSetting"
value_to_set = 1 ' 0=off, 1=on


set cimv2 = GetObject( cimv2_string )
set items = cimv2.ExecQuery( query )

for each item in items

	item.SetAllowTSConnections( value_to_set )

next
' -------------------------------------------------
Published Thursday, November 24, 2005 3:16 PM by saveenr

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Script to Enable Remote Desktop

This does not seem to work on Longhorn Server.  
Tuesday, April 04, 2006 3:01 PM by Anonymous

# re: Script to Enable Remote Desktop

Longhorn server has this class moved to the different namespace root\cimv2\terminalservices (Just like Vista).

cimv2_string should read

cimv2_string = "WINMGMTS:" & "\\" & machine & "\root\cimv2\terminalservices"

on vista or longhorn

Friday, February 02, 2007 8:18 AM by Kim Oppalfens

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker