Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Active Directory User Create

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,38570
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Active Directory User Create
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Active Directory User Create - 10/10/2006 8:47:07 PM   
  bliblablu

 

Posts: 2
Score: 0
Joined: 10/10/2006
Status: offline
Hi,

with this script i'm creating X users in Microsoft Active Directory services. The users have the account name UserNo1 - 200 (in this example). My problem is, the UserNo1-99 are created with UserNo1-X. How is it possible that those Users are named UserNo001 - UserNo099? (<- 001 not just 1).


      
Thanks in advance!
 
 
Post #: 1
 
 RE: Active Directory User Create - 10/10/2006 11:47:23 PM   
  ehvbs

 

Posts: 2222
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi bliblablu.

try:

For i = 1 To 200
   sUser = UserNo" & Right( "000" & i, 3 )
   Set objLeaf = objContainer.Create("User", "cn=" &  sUser)
   objLeaf.Put "sAMAccountName",  sUser
   objLeaf.SetInfo
   ...

(not tested)

Good luck

(in reply to bliblablu)
 
 
Post #: 2
 
 RE: Active Directory User Create - 10/11/2006 4:44:36 AM   
  esnmb

 

Posts: 452
Score: 0
Joined: 1/11/2005
From: USA
Status: offline
From MS Script Center:

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

Set objContainer = GetObject("LDAP://cn=Users," & _
objRootDSE.Get("defaultNamingContext"))

For i = 1 To 1000
Set objLeaf = objContainer.Create("User", "cn=UserNo" & i)
objLeaf.Put "sAMAccountName", "UserNo" & i
objLeaf.SetInfo
Next

WScript.Echo "1000 Users created."

(in reply to bliblablu)
 
 
Post #: 3
 
 RE: Active Directory User Create - 10/12/2006 6:30:34 PM   
  bliblablu

 

Posts: 2
Score: 0
Joined: 10/10/2006
Status: offline
Did you read/understand my post esnmb?

Thanks ehvbs, it will create the first UserNo001 but nothing else 

Any ideas?

(in reply to esnmb)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Active Directory User Create Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts