Report Offensive Message

This scrip works to creat user, and passwords for win server 2003
Here is the script:
' ---------------------------------------------------
' Script: createusersfromcsv.vbs
' Author: Scott Lowe
' Input: CSV file with layout logonname,firstname,lastname,password
' Date: December 21, 2005
' Change log:
' no changes
' Rev: by: Hector Guerra 10-16-2007
' Help by and rewrite by: Sergio Mion
'----------------------------------------------------

Option Explicit

Dim sCSVFileLocation
Dim sCSVFile
Dim objFSO
Dim objFile
Dim strLine
Dim strItems
Dim oNewUser

' ----------Variables needed for LDAP connection----------
Dim oRootLDAP
Dim oContainer

' ----------Holding variables for information import from CSV file
Dim sLogon
Dim sFirstName
Dim sLastName
Dim sDisplayName
Dim sPassword
Dim nPwdLastSet
Dim nUserAccountControl ' Used to enable the account
Dim sDomain

' ----------Modify this to match your company's AD domain----------
sDomain="Autocadcc6.us"

' ----------Input file location----------
sCSVFileLocation = "C:\Scripts\"
' ----------Full path to input file----------
sCSVFile = sCSVFileLocation&"studentinfo45.csv"

' ----------Commands used to open the CSV file and select all of the records----------
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile(sCSVFile, 1)

' ----------Create a connection to the Active Directory Users container.----------
' ----------My OU's are 2-3 period, 4-5 period, 7-8 period. My server name is CAD.----------
Set oContainer = GetObject("LDAP://cad/OU=4-5 Period,dc=Autocadcc6,dc=us")

' ----------Allows processing to continue even if an error occurs (i.e. dup user)----------
' We put this below the CSV and AD information since processing can
' continue with a single bad record, but not if there is a problem with
' the CSV file or AD connection
on error resume next

Do Until objFile.AtEndOfStream ' Reads the values (cells) in the sInputFile file.
' --------- Start creating user account----------
' Read variable information from the CSV file
' and build everything needed to create the account
strLine = objFile.ReadLine
strItems = split(strLine,",")

sLogon = strItems(0)
sFirstName = strItems(1)
sLastName = strItems(2)
sDisplayName = sFirstName&" "&sLastName
sPassword = strItems(3)

' ----------Build the User account----------
Set oNewUser = oContainer.Create("User","cn="&sFirstName&" "&SLastName)

oNewUser.put "sAMAccountName",lcase(sLogon)
oNewUser.put "givenName",sFirstName
oNewUser.put "sn",sLastName
oNewUser.put "UserPrincipalName",lcase(SLogon)&"@"&sDomain
oNewUser.put "DisplayName",sDisplayName
oNewUser.put "name",lcase(sLogon)

' ----------Write this information into Active Directory so we can----------
' modify the password and enable the user account
oNewUser.SetInfo

' ----------Change the users password----------
oNewUser.SetPassword sPassword
oNewUser.Put "pwdLastSet", -1

' ----------Enable the user account----------
oNewUser.Put "userAccountControl", 512
oNewUser.SetInfo

Loop
objFile.Close

' ----------Used only for debugging----------
'if err.number = -2147019886 then
' msgbox "User logon " & sLogon & "already exists"
'End If

' --------- End of user account creation----------
Posted by nukwar@...
31st Oct 2007