Were in the process of rolling out over 1000 workstations that need to
be placed within different OU's.

I \'d like to know if there are any scripts that can read a text file a
pre-create the workstation accounts in the given OU's then when we
actually join the workstations to the domain they will fall into the
correct OU.....

Thanks in advnace........

Re: Create computer account in specified AD OUs by Momo

Momo
Fri Dec 02 00:00:22 CST 2005

I've found some resources with the following script, however:


'Script configuration
strBase=3D
"OU=3DHK,OU=3DWorkstations,OU=3DHKG,DC=3Dmomo,DC=3Dhk,DC=3Dpwcinternal,DC=
=3Dcom"
strComp =3D "WORKSTATION001"
strDescr =3D "Test PC"


'ADS_User_Flag_Enum
Const ADS_UF_WORKSTATION_TRUST_ACOUNT =3D &h1000


Set objCont =3D GetObject("LDAP://" & strBase)
Set objComp =3D
objCont.Create("computer","OU=3DHK,OU=3DWorkstations,OU=3DHKG,DC=3Dmomo,DC=
=3Dhk,DC=3Dpw=ADcinternal,DC=3Dcom"

& StrComp)
objComp.Put "sAMAccountName", StrComp & "$"
objComp.Put "description", strDesc
objCom.Setinfo
WScript.Echo "Computer account for " & StrComp & " created."


But when it actually runs it gives me an error regarding the strComp
value.... any one have ideas on how to fix this..........


I will be running the script from a DC with Domain Admin rights......