Documentos de Académico
Documentos de Profesional
Documentos de Cultura
AutomatingCreationofActiveDirectoryUsers
Page1 of 4
Thebatchfiledoestwothings.TheMDcommandmakesahomedirectoryfortheuserina sharedfoldercalled\users.Nomysterythere.Thedsaddcommandistheallsingingalldancing commandtoaddtheusersnameandpassword,andanyotherinformationthatyouwanttoadd totheActiveDirectory.Thesesaredomainaccountsintendedforstaff usingworkstations attachedtotheserver.OncetheaccountsareaddedthroughtheCMDfile,theyappearinthe ActiveDirectoryUsersandComputersmanagementconsole. Walkingthroughthisversionofdsadd,itshowsthat: 1. Kendrasloginiskrome Herdisplayname,isKendraRome 2. Herpasswordisadded,withthreelowercaseletters,twodigitsandthreemorelower caseletters.Notethatthisdoesnotmeetthedefaultcomplexity passwordrequirements setinWindows2003.Thedefaultcanbealteredin thegrouppolicysnapin. 3. Thepasswordcannotbechangedanditdoesnotexpire. 4. ImcurrentlyusingtheADdescriptionfieldtoholdtheuserstitle. 5. TheADoffice fieldissettothenameofheroffice. 6. Isetherhomedirectorybasedonhername,tomatchthedirectorycreatedinthefirst command. 7. Finally,Iaddhertoagroup CVABE thatIvepreviouslycreated.Usersarealso automaticallyaddedtothebuiltin domainusersgroup.
Definingthedatabasetable
Thedatabaseisasingletable,whichcouldbecreatedinprettymuchanyprogram.Iendedup startingthetableinExcel,andthenexportedtheexcelspreadsheettoVisualFoxPro.However, aslongasyoucaneventuallyusethetabletowritetextoutput,youcanuseanyprogramtohold thedata.Evenacommadelimitedtextfilewilldo. FieldName Common Login Password First Last Canchpwd Passexpire Descrip Office Homedir Type Character Character Character Character Character Character Character Character Character Character Width 25 16 12 12 12 3 3 25 25 16 Comment CommonName,i.e.MarySmith LoginName,i.e.msmith Userspassword,i.e.,abc99xyz Usersfirstname Userslastname YesorNo(writtenout,notabooleanfield) YesorNo(writtenout,notabooleanfield) Userdescription Userslocation Sameastheloginname
InthespreadsheetoraFoxProBrowse, thedataitselfwilllooksomethinglikethis:
AutomatingCreationofActiveDirectoryUsers
Page2 of 4
Oncetheuser.cmdiscreated,itisrunontheserverscommandline.
Enhancements
OnethingInoticedwaswhenIrantheuser.cmdprogram,thefirsttime,Ireceivedseveral errors.SoImadeahardcodedremovalprogramwhichremovedallofmynewusers.This consistsofasinglelineforeachuser,usingthedsrmcommand:
dsrm"CN=StefanNichols,CN=Users,DC=microdesign,DC=mxdesign,DC=net"& noprompt
Alternatives
ThedatabasetablecanbebuiltinanythingthatcanoutputASCIItext.TheTextMergeprogram couldalsobewritteninPerl,orevenSQL. Eventually,withtheabilitytoquerytheActive Directory with dsqueryyouhavethebeginningsofacompleteadusermanagementsystem. Finally,youcouldeliminatethewholecommandfileinterfacebycreatingasimilarprogramthat wrotetotheActiveDirectoryobjectsinVisualBasic,C#orAccess.
AutomatingCreationofActiveDirectoryUsers
Page4 of 4