用VBS向AD服务中添加测试数据

1,前言

  项目中需要用AD服务的测试数据。有个例子,很好用。

Set objDomain = GetObject("LDAP://dc=test,dc=local")
Set objOU = objDomain.Create("organizationalUnit", "ou=adUser4")
objOU.SetInfo
Set objOU = GetObject("LDAP://OU=adUser4,dc=test,dc=local")

For i = 1 To 10000
    Set objUser =objOU.Create("User", "cn=UserNod" & i)
    objUser.Put "sAMAccountName", "UserNod" & i
    objUser.SetInfo
    
    objUser.put "description", "cardidd" & i
    objUser.SetInfo
    
    objUser.SetPassword "mypass" 
    objUser.AccountDisabled = FALSE
    objUser.SetInfo
Next
 

你可能感兴趣的:(vbs)