What the script does is to connect to Active Directory, then create
a XPSimple in the 'Computer' container.
GetObject connects to ("LDAP://rootDSE") that is why the script will work on
any domain. Then it extracts the domain name ("defaultNamingContext") and
builds the path to the "Computer" container.
' VBScript to create one computer ' Guy Thomas January 2003
strComputer = "XPSimple"
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Computers," & _
objRootDSE.Get("defaultNamingContext"))
' Get Domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDomain = objRootDSE.Get("DefaultNamingContext")
' Create OU = strOU
Set objDomain = GetObject("LDAP://" &strDomain )
Set objOU = objDomain.Create("organizationalUnit", "ou=" & strOU)
objOU.SetInfo
' Create Computers
For intComputerNum = 1 To 10
Set objLeaf = objOU.Create("Computer", "cn=" & StrXPStation & intComputerNum)
objLeaf.Put strSam, strXPStation & intComputerNum & "$"
' 512 means Enable the Account
objLeaf.Put "userAccountControl",512
objLeaf.SetInfo
objLeaf.SetInfo
Next
intComputerNum = intComputerNum -1
WScript.Echo intComputerNum & " Machines created in " & strOU & " OU"
WScript.Quit
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.
There are also two bonus tools in the free download, and all 3 have been approved by Microsoft:
Save
hours of frustration and buy Guy's eBook. The features include:
detailed examples on how to import LDAP properties from a spreadsheet, Do...Loop
Until explained, connect to your domain with RootDSE.
You get a printer friendly version with copy
enabled, and no expiry date.
Windows Management Instrumentation (WMI) is one of the hidden
treasures of Microsoft operating systems.
Fortunately, Solarwinds
have created the
Free WMI Monitor so that you can actually see and understand these gems of
performance information. Take the guess work out of which
WMI counters to use for applications like Microsoft Active Directory,
SQL or Exchange Server.