| |
srinivenkatesan
Posts: 2
Score: 0
Joined: 4/30/2008
Status: offline
|
I am trying to create a list of users from Active Directory to an ADAM instance(Active Directory Application Mode). So I took a snippet to create a single user. I am not sure, why I get a naming violation on the last statement in the following script.(objUser.SetInfo ). Any help is appreciated !! ' The following code will add a new user to an ADAM instance '---------------- SCRIPT CONFIGURATION ----------------- strComputerName = "localhost" ' Use "localhost" for the local computer strPort = "389" ' the LDAP port number to connect to strAppPart = "ou=Adam users,o=Microsoft,c=US" ' ie "o=rallencorp,c=us" Wscript.Echo strAppPart strUserDN = "Joe Smith" ' ie "Joe Smith" strUPN = "joe@rallencorp.com" ' ie "joe@rallencorp.com" '------------------------------------------------------- Set objOU = GetObject("LDAP://" & strComputerName & ":" & strPort & "/" & strAppPart) objOU.Filter = Array("group") for each obj in objOU Wscript.Echo obj.name for each member in obj.Members Wscript.Echo member.name next next Set objUser = objOU.Create("user", strUserDN) objUser.Put "displayName", strUserDN objUser.Put "userPrincipalName", strUPN objUser.SetInfo Result Window: C:\VBScripts>Cscript CreateUsers.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. ADAM_devinstance1 -- Running ou=Adam users,o=Microsoft,c=US CN=Adam Testers CN=S-1-5-21-1169774684-3328196929-2088990163-500 CN=Mary Baker C:\VBScripts\CreateUsers.vbs(45, 1) (null): There is a naming violation.
|
|