' Kod tworzy konto komputera w bazie danych usugi Active Directory
' ------ KONFIGURACJA SKRYPTU ------
strBase = "<NazwaWyrniajcaObiektuNadrzdnegoKomputera>"  ' np. 
                                                                                                               ' cn=Computers,dc=rallencorp,dc=com
strComp = "<NazwaKomputera>"      ' np. jan-xp
strDescr = "<Opis>"      ' np. Stacja robocza Jana z systemem Windows XP
' ------ KONIEC KONFIGURACJI ---------

' ADS_USER_FLAG_ENUM
Const ADS_UF_WORKSTATION_TRUST_ACCOUNT = &h1000

set objCont = GetObject("LDAP://" & strBase)
set objComp = objCont.Create("computer", "cn=" & strComp)
objComp.Put "sAMAccountName", strComp & "$"
objComp.Put "description", strDesc
objComp.Put "userAccountControl", ADS_UF_WORKSTATION_TRUST_ACCOUNT
objComp.SetInfo
Wscript.Echo "Utworzono konto dla komputera " & strComp
