How can I download the script file ?

By vikrant_nath ·
How can I download this script file that would help in Create users in Active Directory from a CSV file.?
I have come to the location
but still not able to download the file.
Pls help

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

If clicking on the 'Download' button doesn't work, when ...

by OldER Mycroft In reply to How can I download the sc ...

the next window opens up, try clicking on the line that reads:

If a new window did not open for your download, please click here.

That should do it. :)

Collapse -

And when you have checked it out

by Jacky Howe In reply to How can I download the sc ...

have a look here for a bit more info on what you can achieve with VB Scripts.

Collapse -

You need to logon and enable pop ups!!

by ComputerCookie In reply to How can I download the sc ...

Here's the text;

Create users in Active Directory from a CSV file with this VBScript
By Scott Lowe
Creating users can be tedious, especially when user information already resides in your company?s HR system. Instead of manually creating a user and assigning passwords, you can use a script that accomplishes the same goal. The benefits: Fewer iterations of the information will result in fewer errors; you don?t need to worry about whether or not a user account gets created; and, you can focus on more strategic IT tasks.
This script will create users with passwords in Active Directory in the Users container. You must make a few minor modifications, explained below, for the script to work in your environment.
A few notes about this script
It?s best to execute these scripts from a domain controller while logged in with administrative credentials. Of course, you can use the Windows Scheduler to handle this. Second, I?m assuming that you can get a comma-separate value (CSV) extract from whatever ERP system you use. Finally, I save my scripts in the C:\Scripts folder on my lab server and also placed the CSV file extract in that location.
Before you begin writing Windows scripts, create a file called schema.ini and place it in your scripts folder. The contents of schema.ini should be:
Why do you need this? If your CSV file doesn?t have a header row, some versions of (Microsoft Data Access Components) MDAC have problems processing the first row of data in your CSV extract file. Basically, your script may complete ignore the first row of information. If you do use a header row (which I do not for these examples), you don?t need to create this file.
Modifications you need to make
Make the following modification before using the script:
1. Change the value of the sDomain variable to match the name of your Active Directory environment. I've used for my sample script.
2. Change the value of the sCSVFileLocation variable. This is the directory in which you will store a CSV file. Be sure to keep the trailing slash at the end of the variable.
3. Change the value of the sCSVFile variable. This is the name of your CSV file. I've used "example.csv" in my script.
Using this script
One very important note: the passwords that you use in your CSV file to be imported must meet your system's minimum complexity requirements. If they do not, the user will not be assigned a password.
You can use this script manually by executing cscript createusersfromcsv.vbs from the command line. No command line parameters are required since everything is handled from within the script. You could also schedule this script to be run on a periodic basis.
Create users in Active Directory from a CSV file with this VBScript
' ---------------------------------------------------
' Script: createusersfromcsv.vbs
' Author: Scott Lowe
' Input: CSV file with layout logonname,firstname,lastname,password
' Date: December 21, 2005
' Change log:
' no changes
Option Explicit
Dim sCSVFileLocation
Dim sCSVFile
Dim oConnection
Dim oRecordSet
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
' Input file location
sCSVFileLocation = "C:\Scripts\" 'KEEP TRAILING SLASH!
' Full path to input file
sCSVFile = sCSVFileLocation&"Book2.csv"
' Commands used to open the CSV file and select all of the records
set oConnection = createobject("adodb.connection")
set oRecordSet = createobject("adodb.recordset") "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & sCSVFileLocation & ";Extended Properties=""text;HDR=NO;FMT=Delimited""" "SELECT * FROM " & sCSVFile ,oConnection
' Create a connection to the Active Directory Users container.
Set oRootLDAP = GetObject("LDAP://rootDSE")
Set oContainer = GetObject("LDAP://cn=Users," & _
' 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
Page 2
Copyright ?2006 CNET Networks, Inc. All rights reserved.
For more downloads and a free TechRepublic membership, please visit
Create users in Active Directory from a CSV file with this VBScript
on error resume next
do until oRecordSet.EOF ' 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
sLogon = oRecordSet.Fields.Item(0).value
sFirstName = oRecordSet.Fields.Item(1).value
sLastName = oRecordSet.Fields.Item(2).value
sDisplayName = sLastName&", "&sFirstName
sPassword = oRecordSet.Fields.Item(3).value
' 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
' Change the users password
oNewUser.SetPassword sPassword
oNewUser.Put "pwdLastSet", 0
' Enable the user account
oNewUser.Put "userAccountControl", 512
' Used only for debugging
'if err.number = -2147019886 then
' msgbox "User logon " & sLogon & "already exists"
'End If
' --------- End of user account creation
Page 3

Related Discussions

Related Forums