• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Active directory users

Diaonic

Senior member
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.
 
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.


 
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

 
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.
 
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.
 
Back
Top