Create NT4 BDC (VBScript)

This code can be found in Chapter 3 of Active Directory Cookbook, 2nd edition

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This code creates a computer object for an NT4 BDC.

' ------ SCRIPT CONFIGURATION ------
strBase = "<ParentComputerDN>"  ' e.g. cn=Computers,dc=rallencorp,dc=com
strComp = "<ComputerName>"      ' e.g. joe-xp
strDescr = "<Description>"      ' e.g. Joe's Windows XP workstation
' ------ END CONFIGURATION ---------
     
Const NT4 = &h2020
     
set objCont = GetObject("LDAP://" & strBase)
set objComp = objCont.Create("computer", "cn=" & strComp)
objComp.Put "sAMAccountName", strComp & "$"
objComp.Put "description", strDesc
objComp.Put "userAccountControl", NT4
objComp.SetInfo
Wscript.Echo "Computer account for " & strComp & " created"

This code has been viewed 1842 times.

New from the creators of TechTasks.com: StatSheet.com