See More on CSVDE and
LDIFDE
Alternatives to CSVDE and LDIFDE
Having given an honest and fair account of both CSVDE and LDIFDE, I urge you also to consider
PowerShell or VBScript for
creating Active Directory accounts.
PowerShell and Active Directory
# PowerShell Connects to Active Directory # Connect to hard-coded root # Author: Guy Thomas # Version 1.3 Sept 2007 tested on PowerShell v 1.0 and RC2 $Dom = 'LDAP://DC=cp;DC=mosel' $Root =
New-Object DirectoryServices.DirectoryEntry $Dom Write-host "PowerShell connects to domain: $Dom"
Learning PointsNote 1: 'LDAP://DC=cp;DC=mosel'. Rather than using the traditional .local namespace for non-internet domains, I prefer .mosel merely because it happens to be the road where I live!
Naturally you changed the value for this $Dom variable in your live script? Didn't you? Note 2: New-Object is such an insignificant command, yet it is vital for creating objects, which
we can
use for connecting connect to Active Directory. Note 3: DirectoryServices.DirectoryEntry is one of the key commands to connect to Active Directory. I think of this as a pipeline to the root of my
domain's namespace.
See more on
PowerShell and Active Directory
Guy Recommends: SolarWinds' Free Bulk Import Tool
Import users from a spreadsheet. Just provide a list of the
users with their fields in the top row, and save as .csv file.
Then launch this FREE utility and match your fields with AD's
attributes, click and import the users.
Optionally, you can
provide the name of the OU where the new accounts will be born.
Download your FREE bulk import tool.
If you need more comprehensive software,
download a free trial of SAM (Server & Application Monitor)
VBScript
While VBScript is not as quick and is more difficult to learn, in the long term
On this page we concentrate on
the essential VBscript commands necessary to build a User account in Active Directory Users and Computers. For example, GetObject("LDAP://rootDSE") and .Create("User"). Even
though I am experienced at creating VBScripts, I still run manually through creating the object in Active Directory Users and Computers, the menus actions help me to rehearse the stages in my scripts.
PrerequisitesI recommend that you logon at a Windows Server domain controller. If you are a long way from the server, Remote Desktop would be a suitable alternative. If that is not possible, you
could get these scripts to work from an XP machine as a non-administrator. However, why introduce extra complications? Especially at the beginning, you want easy success, with fewest obstacles.
Instructions for Creating a User Account in Active Directory - You should run this VBScript on a Windows Active Directory domain.
- Copy and paste the example script below into notepad or a VBScript editor.
- Decide whether to change the value for strUser. DomGuy2 is not a particularly attractive name.
- Save the file with a .vbs extension, for example: Users .vbs.
- Double click Users .vbs and check the Users container for strUser.
Script to Create a User in a Named OU (Organizational Unit)
' Users .vbs ' Sample VBScript to create a User in Users . ' Author Guy Thomas http://Computerperformance.co.uk/
' Version 1.3 - September 2010 '
------------------------------------------------------' Option Explicit Dim strUser Dim objRootLDAP, objContainer, objNewUser strUser = "DomGuy2"
' Bind to Active Directory,
Users container. Set objRootLDAP = GetObject("LDAP://rootDSE") Set objContainer = GetObject("LDAP://cn=Users," & _ objRootLDAP.Get("defaultNamingContext"))
' Build the actual User. Set
objNewUser = objContainer.Create("User", "cn=" & strUser) objNewUser.Put "sAMAccountName", strUser objNewUser.SetInfo
WScript.Quit
' End of free sample Create Users VBScript.
Note 1: The first 10 lines explain the purpose of the script and declare the variables.
Note 2: The simple, but clever command,
which allows the script to work with any domain
is: GetObject("LDAP://rootDSE"). Crucial, this statement binds WSH / VBScript to Active directory. The next line puts the focus on the Users container, as that is where the user will be
born. Incidentally, the correct syntax is cn=users, whereas OUs that you create need the OU= prefix, for example OU=Accounts,.
VBScript -
See more here
See
More on CSVDE and LDIFDE
|