'========================================================================== ' 'VBScript: AUTHOR: Ed Wilson , msft, 6/21/2006 ' 'NAME: 'ver 2.0 'COMMENT: Key concepts are listed below: '1.This script uses the new IADsTSUserEx interface from Windows 2003 to '2.Set properties on the ts profile of the user. '========================================================================== Option Explicit On Error Resume Next Dim strProvider 'Defines how will talk. Dim strOU 'Path to where object is located Dim strDomain 'Name of domain connecting to Dim strOUName 'User name Dim objUser 'Holds connection to ADSI strProvider = "LDAP://" strOU = "ou=mred," strDomain = "dc=nwtraders,dc=msft" strOUName = "cn=myNewUser," Const blnENABLED = 1 '1 enabled, 0 disabled Const strHOME_DIR = "\\London\Shared\" 'UNC to home dir share. Uses username from funfix Const strHOME_DRIVE = "t:" 'Drive letter to use when mapping homedrive Const strPROFILE_PATH = "\\London\Profiles\" 'UNC to profile storage location. Uses username from funfix Set objUser = GetObject(strProvider & strOUName & strOU & strDomain) objUser.AllowLogon = blnENABLED objUser.TerminalServicesHomeDirectory = strHOME_DIR & funfix(strOUName) objUser.TerminalServicesHomeDrive = strHOME_DRIVE objUser.TerminalServicesProfilePath = strPROFILE_PATH & funfix(strOUname) objUser.SetInfo subError '***************** Subs and Functions are below ************** Sub subError If Err.Number = 0 Then WScript.Echo("User " & funFix(strOUName) & " was modified") Else WScript.echo "An error occurred. It was: " & Err.Number End If End Sub 'Funfix function allows to use same variable for GetObject and properties Function funfix (strin) funFix = Mid(strin,4) 'Removes cn= from strOUName to give username funfix = Mid(funFix,1,Len(funFix)-1) 'Removes "," from end of strOUName End Function