MSFN Forum: windows 2000 adsi scriting - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

windows 2000 adsi scriting adsi scriting query+windows 2000 ads Rate Topic: -----

#1 User is offline   s_hcl 

  • Group: Members
  • Posts: 4
  • Joined: 22-March 06

Posted 23 March 2006 - 12:21 AM

I have windows 2003 domain named as tele.com and the domain controller holding all the roles are prod.tele.com.

While creating an adsi script for creating a user ,i tried the following.To try the scripts ,i created an OU named test

using the graphical interface.I wanted to create an User named test1 in that OU.


set objOu=GetObject("LDAP://ou=test,dc=prod,dc=tele,dc=com")
set objUser=objOu.Create("User","cn=test1")
objUser.Put "sAMAccountName","test1"
objUser.Setinfo

when i ran the above script ,it gave me an error ,Object not found ,withthe usual error code.


I moddified the script by changing the LDAP path, as...

set objOu=GetObject("LDAP://ou=test,dc=tele,dc=com")


and it worked...

My query is ,why did not it took the ldap path dc=prod,dc=tele,dc=com..

I had the same problem while restoring an object from an OU.

Any ideas


#2 User is offline   nmX.Memnoch 

  • MSFN Master
  • Group: Moderator
  • Posts: 2,086
  • Joined: 15-September 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 23 March 2006 - 02:35 AM

Because prod.tele.com is the name of your domain controller. When doing LDAP queries you want to use the name of the Active Directory Domain...which in your case is tele.com. What you observed is the expected behavior.

#3 User is offline   tguy 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 698
  • Joined: 19-May 04

Posted 06 June 2006 - 11:08 PM

Maybe this ADSI script will help. Look into the RootDSE...

Set objRootDSE = GetObject("LDAP://rootDSE")

Set objContainer = GetObject("LDAP://OU=ADTEST,OU=APPS,OU=CAMPUS," & _
objRootDSE.Get("defaultNamingContext"))

For i = 1 To 100
Set objLeaf = objContainer.Create("User", "cn=Test" & i)
objLeaf.Put "sAMAccountName", "Test" & i
objLeaf.SetInfo
objLeaf.SetPassword("password" & i)
objLeaf.AccountDisabled = False
objLeaf.SetInfo
Next

WScript.Echo "100 Users created."

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy