Add user to Remote Desktop Users (VBScript)

This code can be found in Chapter 17 of Windows Server 2003 Security Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This code adds a user to the the Remote Desktop Users group/
' ------ SCRIPT CONFIGURATION ------
strGroupDN = "<GroupDN>"  
' e.g. cn=Remote Desktop Users,cn-builtin,dc=rallencorp,dc=com

strMemberDN = "<MemberDN>" 
' e.g. cn=jsmith,cn=users,dc=rallencorp,dc=com
' ------ END CONFIGURATION ---------
set objGroup = GetObject("LDAP://" & strGroupDN)
' Add a member
objGroup.Add("LDAP://" & strMemberDN)
WScript.Echo strMemberDN & " added to group " & strGroupDN

This code has been viewed 5533 times.

New from the creators of TechTasks.com: StatSheet.com