Active directory users

Diaonic

Senior member
May 3, 2002
305
0
0
Is it possible to create multiple users in active directory from the command and specify parameters such as:

Home folder
Profile location
logon script
Group memberships


I have a lot of users that I need to impliment and any time I could save would be huge.


Thanks in advance.
 

Diaonic

Senior member
May 3, 2002
305
0
0
Yea i'v looked at that before. Have really what I'm looking for. I need to create about 200 accounts from either a tab delimited or excel spread sheet and import them into active directory. When they import I want a default password on all accounts and I need to put them into a particular OU and group.


 

Diaonic

Senior member
May 3, 2002
305
0
0
This is the closest i'v got. This creates a users with specified parameters but it doesn't import from an external source.


' -------------------------------------------------------------------------
' From the book Inside Active Directory, ISBN 0-201-61621-1
' Copyright (C) 2002 by Addison-Wesley
' Script by Sakari Kouti (see http://www.kouti.com)
' You have a royalty-free right to use, modify, reproduce and distribute
' this script (and/or any modified version) in any way you find useful,
' provided that you agree that Addison-Wesley or Sakari Kouti has no
' warranty, obligations or liability for the script. If you modify
' the script, you must retain this copyright notice.
' -------------------------------------------------------------------------
Option Explicit
Const UF_SMARTCARD_REQUIRED = &H40000
Call CreateUser("Jack", "Brown")
Sub CreateUser(strFirstName, strLastName)
Dim objContainer, objUser, objLargeInt, strSAMName, intUserFlags
Set objContainer = _
GetObject("LDAP://OU=Sales,DC=sanao,DC=com")
Set objUser = objContainer.Create("user", _
"CN=" & strLastName & " " & strFirstName)
'The Essential Properties
'-----------------------
strSAMName = strFirstName & Left(strLastName, 1)
Call objUser.Put("sAMAccountName", strSAMName)
Call objUser.Put("userAccountControl", &H200)
Call objUser.Put("userPrincipalName", _
strFirstName & "." & strLastName & "@sanao.com")
objUser.SetInfo
objUser.SetPassword ("secret")
objUser.GetInfo
'The Significant Properties
'-------------------------
Call objUser.Put("profilePath", "\\dc1\Prof$\" & strSAMName)
'We let Group Policy take care of the logon script setting
Call objUser.Put("homeDirectory", "\\dc1\" & strSAMName)
Call objUser.Put("homeDrive", "H:")
'User must NOT change password at next logon
Set objLargeInt = CreateObject("LargeInteger")
objLargeInt.LowPart = &HFFFFFFFF
objLargeInt.HighPart = &HFFFFFFFF
Call objUser.Put("pwdLastSet", objLargeInt)
objUser.AccountDisabled = True
intUserFlags = objUser.Get("userAccountControl")
intUserFlags = intUserFlags Or UF_SMARTCARD_REQUIRED
'If we wanted to clear a setting instead of setting it:
'intUserFlags = intUserFlags And Not UF_SMARTCARD_REQUIRED
Call objUser.Put("userAccountControl", intUserFlags)
'The Informational Properties
'-------------------------
Call objUser.Put("givenName", strFirstName)
Call objUser.Put("initials", _
Left(strFirstName, 1) & Left(strLastName, 1))
Call objUser.Put("sn", strLastName)
Call objUser.Put("displayName", strFirstName & " " & strLastName)
Call objUser.Put("telephoneNumber", "555-4268")
Call objUser.Put("otherTelephone", Array("555-6122", "555-7991"))
CH11-08 ADSI Create a User with More Attributes.vbs

objUser.SetInfo
Set objUser = Nothing
End Sub
CH11-08 ADSI Create a User with More Attributes.vbs

 

Diaonic

Senior member
May 3, 2002
305
0
0
I haven't exported the users yet. But it will be very simple.

Firstname, Lastname

and I would like to add them to "Class of 2010" group and "all students"


Thanks for all the responses thus far, i'm getting closer.
 

nweaver

Diamond Member
Jan 21, 2001
6,813
1
0
have you looked into a netsh script? I think it can add entries to AD. I wrote a simple perl script that would pull info line by line to add entries to the DHCP server of our domain, I would think you could do the same thing with users. I think i had a comma seperated line that had IP,MAC Addy, Description.