Derrick
2007-08-01 23:00:02 UTC
Hi, I found this script (see below) from the TechNet CD for creating a
ComputerName account in Active Directory. The script ran fine. I created
the account in AD but when I try to join the computer to the domain, I could
not get it to join. If I manually create the CN account in AD, I can join
the computer just fine. I was wondering if someone had tried it and if you
know what is wrong?
Thank you,
Derrick
Description
Creates and enables a computer account in Active Directory, which must be
used by an Administrator when adding a workstation to the domain.
Script Code
strComputer = "atl-pro-001"
Const ADS_UF_PASSWD_NOTREQD = &h0020
Const ADS_UF_WORKSTATION_TRUST_ACCOUNT = &h1000
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Computers," & _
objRootDSE.Get("defaultNamingContext"))
Set objComputer = objContainer.Create("Computer", "cn=" & strComputer)
objComputer.Put "sAMAccountName", strComputer & "$"
objComputer.Put "userAccountControl", _
ADS_UF_PASSWD_NOTREQD Or ADS_UF_WORKSTATION_TRUST_ACCOUNT
objComputer.SetInfo
ComputerName account in Active Directory. The script ran fine. I created
the account in AD but when I try to join the computer to the domain, I could
not get it to join. If I manually create the CN account in AD, I can join
the computer just fine. I was wondering if someone had tried it and if you
know what is wrong?
Thank you,
Derrick
Description
Creates and enables a computer account in Active Directory, which must be
used by an Administrator when adding a workstation to the domain.
Script Code
strComputer = "atl-pro-001"
Const ADS_UF_PASSWD_NOTREQD = &h0020
Const ADS_UF_WORKSTATION_TRUST_ACCOUNT = &h1000
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Computers," & _
objRootDSE.Get("defaultNamingContext"))
Set objComputer = objContainer.Create("Computer", "cn=" & strComputer)
objComputer.Put "sAMAccountName", strComputer & "$"
objComputer.Put "userAccountControl", _
ADS_UF_PASSWD_NOTREQD Or ADS_UF_WORKSTATION_TRUST_ACCOUNT
objComputer.SetInfo