'========================================================================== ' ' NAME: ' ' AUTHOR: Ed Wilson , MS ' DATE : 6/13/2006 ' ' COMMENT: '1.Based upon the createOU script, uses many of same variable names '2.Big difference is using user as class, and need to specify user name with cn '3.Use the put method to put information into attributes on the user. '========================================================================== Option Explicit On Error Resume next Dim strProvider 'defines how will talk. Dim strOU ' path to where new object will be created Dim strDomain 'name of strDomain connecting to Dim strClass ' the class of object we are creating Dim strOUname 'name of object are creating Dim objDomain 'holds connection to adsi Dim objOU 'holds handle to create method Dim strUsers 'a string of three users here Dim aryUsers 'an array of users from SPLIT strUsers = "cn=MyBoss,cn=MyDirect1,cn=MyDirect2" aryUsers = Split(strUsers,",") strProvider = "LDAP://" strOU = "OU=mred," 'when using is OU=mred, THE , would be required. strDomain = "dc=nwtraders,dc=msft" strClass = "User" For Each strOUname In aryUsers Set objDomain = GetObject(strProvider & strOU & strDomain) WScript.echo strProvider & strOU & strDomain 'debug Set objOU = objDomain.create(strClass, strOUname) WScript.echo strClass & "," & strOUname 'debug objOU.Put "SAMAccountName", funfix(strOUname) objOU.SetInfo subError Next Sub subError If Err.number = 0 Then WScript.Echo(strOUname & " was created") Else If Err.number = "-2147019886" Then WScript.echo strOUname & " already exists" Else WScript.echo " error on the play " & Err.Number End If End If End Sub Function funfix (strin) funfix = Mid(strin,4) 'removes cn= from username End Function