配置用户电话属性

Const ADS_PROPERTY_UPDATE = 2
Set objUser = GetObject _
(“LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com”)

objUser.Put “homePhone”, “(425) 555-1111”
objUser.Put “pager”, “(425) 555-2222”
objUser.Put “mobile”, “(425) 555-3333”
objUser.Put “facsimileTelephoneNumber”, “(425) 555-4444”  
objUser.Put “ipPhone”, “5555”
objUser.Put “info”, “Please do not call this user account” & _
” at home unless there is a work-related emergency. Call” & _
” this user’s mobile phone before calling the pager number”

objUser.PutEx ADS_PROPERTY_UPDATE, _
“otherHomePhone”, Array(“(425) 555-1112”)
objUser.PutEx ADS_PROPERTY_UPDATE, _
“otherPager”, Array(“(425) 555-2223”)
objUser.PutEx ADS_PROPERTY_UPDATE, _
“otherMobile”, Array(“(425) 555-3334”, “(425) 555-3335”)
objUser.PutEx ADS_PROPERTY_UPDATE, _
“otherFacsimileTelephoneNumber”, Array(“(425) 555-4445”)
objUser.PutEx ADS_PROPERTY_UPDATE, _
“otherIpPhone”, Array(“6666”)
objUser.SetInfo

配置用户帐户的 Organization 属性

Set objUser = GetObject _
    (“LDAP://cn=Myerken,ou=Management,dc=NA,dc=fabrikam,dc=com”)
   
objUser.Put “title”, “Manager”
objUser.Put “department”, “Executive Management Team”
objUser.Put “company”, “Fabrikam”
objUser.Put “manager”, _
    “cn=AckermanPilar,OU=Management,dc=NA,dc=fabrikam,dc=com”
objUser.SetInfo

Set objUser01 = GetObject _
    (“LDAP://cn=LewJudy,OU=Sales,dc=NA,dc=fabrikam,dc=com”)
Set objUser02 = GetObject _
    (“LDAP://cn=AckersKim,OU=Sales,dc=NA,dc=fabrikam,dc=com”)
   
objUser01.Put “manager”, objUser.Get(“distinguishedName”)
objUser02.Put “manager”, objUser.Get(“distinguishedName”)

objUser01.SetInfo
objUser02.SetInfo

清除 OU 的常规属性

Const ADS_PROPERTY_CLEAR = 1
Set objContainer = GetObject _
  (“LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com”)
 
objContainer.PutEx ADS_PROPERTY_CLEAR, “description”, 0
objContainer.PutEx ADS_PROPERTY_CLEAR, “street”, 0
objContainer.PutEx ADS_PROPERTY_CLEAR, “l”, 0
objContainer.PutEx ADS_PROPERTY_CLEAR, “st”, 0
objContainer.PutEx ADS_PROPERTY_CLEAR, “postalCode”, 0
objContainer.PutEx ADS_PROPERTY_CLEAR, “c”, 0
objContainer.SetInfo

清除属性

Const ADS_PROPERTY_CLEAR = 1

Set objUser = GetObject _
(“LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com”)

objUser.PutEx ADS_PROPERTY_CLEAR, “initials”, 0
objUser.PutEx ADS_PROPERTY_CLEAR, “otherTelephone”, 0

objUser.SetInfo

更改组的作用域

Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2
Const ADS_GROUP_TYPE_LOCAL_GROUP = &h4
Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8
Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000

Set objGroup = GetObject _
   (“LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com”)
objGroup.Put “groupType”, _
  ADS_GROUP_TYPE_GLOBAL_GROUP + ADS_GROUP_TYPE_SECURITY_ENABLED
 
objGroup.SetInfo