Create multilple computer accounts/objects in AD OUs

  • Thread starter Thread starter Zeno
  • Start date Start date
Z

Zeno

I trying to find a script that can create multiple computer accounts in
a give OU...

Since we have over a thousand computer we need to create its best if it
can read a text file or excel and create them..........

Don't need to assign any rights since we'll be using the Admin account
to later JOIN them to the domain..........


If anyone can point me to some resources .......... it'd be much
apprecciated..............
 
Zeno said:
I trying to find a script that can create multiple computer accounts in
a give OU...

Since we have over a thousand computer we need to create its best if it
can read a text file or excel and create them..........

Try searching (site:Microsoft.com) for solutions that involve NetDom,
DSMod (Win2003 not Win2000), or creating ADSI scripts.

All of these give ways to add computer accounts and can by fairly
easily scripted by a journeyman-level programmer (no real expert needed).

For ADSI, you might want to investigate the "ADSI script-o-matic",
available free from Microsoft.

This is especially valuable if you are new to scripting but takes care of
much of the drudge work even if you are an expert.
Don't need to assign any rights since we'll be using the Admin account
to later JOIN them to the domain..........


If anyone can point me to some resources .......... it'd be much
apprecciated..............

NetDom and DSMod run as standard batch commands, do what you
want (probably) but ADSI scripts give you complete contro while
being a bit more difficult to setup initially.
 
Zeno said:
I trying to find a script that can create multiple computer accounts in
a give OU...

Since we have over a thousand computer we need to create its best if it
can read a text file or excel and create them..........

Don't need to assign any rights since we'll be using the Admin account
to later JOIN them to the domain..........


If anyone can point me to some resources .......... it'd be much
apprecciated..............

Just create a CSV file of all the machines that need to be imported as
well as other fields that would be required for "computer" type objects
in ADS. If you don't know which attributes are required then do a small
export of some existing machine accounts and see which attributes were
filled in. I created 500 user accounts this way by exporting current
data from a DB, doing some processing on the data and putting it into
csv format (and making sure I had the required fields filled in for
"user" objects).


use the csvde.exe command to read the file and import the accounts.
 
I actually found a script to do this but just can't figure out why it
errors when I run it....

'Script configuration
strBase=
"OU=HK,OU=Workstations,OU=HKG,DC=momo,DC=hk,DC=internal,DC=com"
strComp = "WORKSTATION001"
strDescr = "Test PC"


'ADS_User_Flag_Enum
Const ADS_UF_WORKSTATION_TRUST_ACOUNT = &h1000


Set objCont = GetObject("LDAP://" & strBase)
Set objComp =
objCont.Create("computer","OU=HK,OU=Workstations,OU=HKG,DC=momo,DC=hk,DC=pw­­cinternal,DC=com"
& StrComp)
objComp.Put "sAMAccountName", StrComp & "$"
objComp.Put "description", strDesc
objCom.Setinfo
WScript.Echo "Computer account for " & StrComp & " created."


But the thing error when it gets to the strComp line............
 
Back
Top