1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
   |  
Dim ParentOU,objDomain 
'Set dse =GetObject("LDAP://RootDSE" ) 
'Set domain = GetObject("LDAP://" & dse.Get("defaultNamingContext" )) 
 
'*************************************************'  
'...Création d'utilisateurs dans l'OU concernée...' 
'*************************************************'      
Set objDomain = GetObject("LDAP://DC=me,DC=local" )     
objDomain.setInfo
Set ParentOU = objDomain.GetObject("organizationalUnit", "OU=?")     
ParentOU.setInfo
'******************************************************'
'...Insertion des informations dans Active Directory...'
'******************************************************'
Set NewUser = ParentOU.create("user", "CN=" & Utilisateur)
 
    WITH NewUser
    .Put "cn", Utilisateur  
    .Put "GivenName",Prenom  
    .Put "sn", Nom  
    .Put "name", Utilisateur  
    .Put "physicalDeliveryofficeName", Site  
    .Put "department", Service  
    .Put "samAccountName", Utilisateur  
    .Put "userPrincipalName", Utilisateur &"@me.local"  
    .Put "DN","cn=" & Utilisateur &",DC=me,DC=local"  
    .Put "Accountexpires", Expiration 
    .setpassword "utilisateur"  
    .accountdisabled = FALSE       
    .Put"pwdLastSet",0       
    END WITH | 
Partager