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......