arrow    Home arrow Knowledge Base arrow Windows XP arrow Enable Remote Desktop using Script
Site Areas
Home
News
Knowledge Base
Web Links
Contact Us
Files
Terms of Use
Profile





Lost Password?
No account yet? Register
Enable Remote Desktop using Script
Written by Terry Watts   
Friday, 22 October 2004
Enable the Remote Desktop feature on Windows XP using simple scripting or remote registry calls.  This information will get you started.

What you need to do is change these registry keys either using Registry Editor (regedit.exe) or using Windows Scripting Host or other program that allows editing of the Windows Registry.

    [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server]
    "fDenyTSConnections"=dword:00000000
    "TSEnabled"=dword:00000001

    As with all Windows Registry Editing - take care as you may end up breaking your computer.

    Now you will need to add users the to local Remote Support User group. This can be done by using the Computer Management Console, Batch scripting, or if you really like, Windows Scripting host.

    This command will add a Domain user to the local security group.  Remember that you will need to be a local administrator of the machine so that you can add users to local groups.

    net localgroup "Remote Desktop Users" %USERDOMAIN%\administrator /add

    It is easy to adapt this command so that local users can be used instead.  Just remove the %userdomain%\ bit from the command.

    If you want to use Windows Scripting, then you can use the following file, just save the file with a .VBS or .WSH extention.  VBS can be ran as a computer startup script in Active Directory Group policy.

    ' This script adds users to the local Remote Desktop Users security group.
    ' Script is free for anyone to use.

    ' Create a Network Object so that we can access local and network security info.
    Set oWshNet = CreateObject("WScript.Network")

    ' Get the current Domain and Computer name that is calling the script.
    sNetBIOSDomain = oWshNet.UserDomain
    sComputer = oWshNet.ComputerName

    ' Create an Object that will link to the Remote Desktop Users group
    Set oGroup = GetObject("WinNT://" & sComputer & "/Remote Desktop Users,group")

    ' suppress errors in case the user is already a member
    On Error Resume Next

    ' Create a Network User object for the Administrator.
    ' Note: replace Administrator with a username of your choice
    Set oUser = GetObject("WinNT://" & sNetBIOSDomain & "/" & "Administrator" & ",user")

    ' Call the Group Object Add command to add our user to the group.
    oGroup.Add(oUser.ADsPath)

    ' Create a Local User object for the Administrator.
    ' Note: replace Administrator with a username of your choice
    Set oUser = GetObject("WinNT://" & sComputer & "/" & "Administrator" & ",user")

    ' Call the Group Object Add command to add our user to the group.
    oGroup.Add(oUser.ADsPath)

    ' Error catchall
    On Error Goto 0

    Use this information at your own risk.  For full details about using Scripting, visit http://www.microsoft.com/scripting

 
go to top Go To Top go to top
This article has been printed from www.schooltechnician.co.uk and is protected under copyright.
See http://www.schooltechnician.co.uk/terms_of_use.html for further details.