'Voila les constantes et les variables dont nous allons avoir besoins : Const DOMAIN = "DC=BJ,DC=BTS" Const ISSYPWD = "IssyPwd0!" Const NYPWD = "NyPwd0!" Const SUFFIX = "@bj.bts" Const UAC = 544 Dim In1, In2, In3, Login, Name, FullName, FullLogin 'vbStyle = vbOkCancel + vbInterrogation + vbDefaultButton1 '========================================== ' SYNTAXE ET UTILISATION DU PROGRAMME' In1 = InputBox("Quel prénom ?","Prénom?","Entrez ici le prénom") In2 = InputBox("Quel nom ?","Nom?","Entrez ici le nom") In3 = InputBox("Quelle site ? (Issy ou New-York)","Unite d'organisation","Issy New-York") Login = Lcase(left(In1,1) & In2) Name = Ucase(In2) FullLogin = Login & SUFFIX FullName = In1 & " " & Name Set objOU = GetObject("LDAP://OU="& In3 &",dc=bj,dc=bts") Set objUser = objOU.Create("User", "cn="&FullName) objUser.Put "sAMAccountName", Login objUser.Put "sn", Name objUser.Put "userPrincipalName", FullLogin objUser.Put "givenName", In1 objUser.Put "displayName", FullName objUser.Put "userAccountControl", UAC objUser.Put "physicalDeliveryOfficeName", In3 objUser.SetInfo 'objUser.Put "userAccountControl", VALEURS :=> '512 - Enable Account '514 - Disable account '544 - Account Enabled - Require user to change password at first logon '66048 - Password never expires '262656 - Smart Card Logon Required
J'espère avoir pu vous aider !! Cordialement BJ