Jump to content

Tool to bulk create users / create single user easily?


Recommended Posts

Posted

Does anyone know of any tool I may be able to use to bulk create users on my Windows 2008 domain? At the moment I do have an excel spreadsheet that creates shares etc but I'd quite like to find a tool to do this especially if it could be set up to create single users simply, as I am a lazy man. :D

 

Thanks

Posted (edited)

Hi,

 

This has been discussed before. Try this post:

 

Edugeeek Link: Active User Manager Post

 

I used it [Active User Manager] on Windows Server 2008 for the first time this year to add users for a whole years' intake and it saved me loads of heartache.

Edited by 6Foot2
Add detail to clarify post.
  • Thanks 2
  • 7 months later...
Posted (edited)

You could try a vb script similar to this and just have a list of accounts you want in an Excel (2003) file:

Option Explicit

Dim objRootLDAP, objContainer, objUser, objShell

Dim objExcel, objSpread, intRow

Dim strUser, strOU, strSheet, strOUGroup, strDomain

Dim strCN, strSam, strFirst, strLast, strPWD

 

 

 

Dim strYear, strServer,strGroup,strDNSDomain,objGroup,strDesc,usersadded

 

usersadded = 0

 

' -------------------------------------------------------------'

' Important change OU= and strSheet to reflect your domain

' -------------------------------------------------------------'

 

 

strYear= "09" 'the year of entry for the pupils

strServer = "nas" 'the server where users home dirs will be stored

 

 

strGroup = "CN=Pupils ,"

strOU = "OU=09Pupils,OU=Pupil Accounts,OU=Accounts ," ' Note the comma

strOUGroup = "OU=Pupil Accounts,OU=Accounts ,"

strDomain = "your domain here"

 

 

strSheet = "C:\createusers\createusers.xls"

 

' Bind to Active Directory, Users container.

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

Set objContainer = GetObject("LDAP://" & strOU & _

objRootLDAP.Get("defaultNamingContext"))

 

' Open the Excel spreadsheet

Set objExcel = CreateObject("Excel.Application")

Set objSpread = objExcel.Workbooks.Open(strSheet)

intRow = 2 'Row 1 often contains headings

 

' Here is the 'DO...Loop' that cycles through the cells

' Note intRow, x must correspond to the column in strSheet

Do Until objExcel.Cells(intRow,2).Value = ""

 

strLast = Trim(objExcel.Cells(intRow, 2).Value)

strFirst = Trim(objExcel.Cells(intRow, 3).Value)

 

 

'code added to create usernames based on pupil names and year of entry

 

strSam = strYear & LCase(Left(strLast,3)) & LCase(Left(strFirst,3))

strCN = strSam

strPWD = "pass" 'the default password for generated accounts

strUser = "CN=" & strSam & " ,"

strDesc = "UPN: " & Trim(objExcel.Cells(intRow, 1).Value) & " DOB: " & Trim(objExcel.Cells(intRow, 4).Value) ; 'adds UPN and DOB to user desc field

 

 

 

 

' Build the actual User from data in strSheet.

Set objUser = objContainer.Create("User", "cn=" & strSam)

 

objUser.sAMAccountName = strSam

objUser.userPrincipalName = strSam & "@" & strDomain

objUser.givenName = strFirst

objUser.sn = strLast

objUser.homeDirectory = "\\" & strServer & "\users$\" & strYear & "\" & strSam

objuser.homeDrive = "M:"

objuser.LoginScript = "logon.bat"

objuser.description = strDesc

 

On Error Resume Next

objUser.SetInfo

 

 

if Err.Number <> 0 then

WScript.Echo "Error Creating: " & strSam & " For " & strFirst & " " & strLast

else

usersadded = usersadded + 1

end if

 

' Separate section to enable account with its password

objUser.userAccountControl = 512

objUser.pwdLastSet = -1

objUser.SetPassword strPWD

objUser.SetInfo

 

'code for Terminal Service Profile Path

 

objUser.TerminalServicesProfilePath = "\\" & strServer & "\UserTSProfiles$\" & strSam

objUser.SetInfo

 

 

'end of added code

 

 

'code to add to Pupils Group

 

Set objRootLDAP = GetObject("LDAP://RootDSE")

strDNSDomain = objRootLDAP.Get("DefaultNamingContext")

 

 

Set objUser = GetObject("LDAP://"& strUser _

& strOU & strDNSDomain)

 

Set objGroup = GetObject("LDAP://"& strGroup _

& strOUGroup & strDNSDomain)

objGroup.add(objUser.ADsPath)

'end of code added

 

 

 

intRow = intRow + 1

Loop

objExcel.Quit

 

WScript.Echo usersadded & " User(s) Added"

WScript.Quit

Edited by g110yd
Guest TheLibrarian
Posted (edited)

I can personally highly recommend this XIA Automation Server - CENTREL Solutions which will not just automate user creation but just about anything I've managed to think of so far.

 

I stress personally because until we use it for 6 - 12 months we won't put the school name to recommend it.

 

It's not free, but it's extremely cheap.

 

And I'm not affiliated to them in anyway.

Edited by TheLibrarian
Not affiliated etc.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...