描述信息
获取现有用户帐号对象属性,并将这些属性复制到通过脚本创建的新增用户帐号对象中。
脚本代码
Const ADS_PROPERTY_UPDATE = 2
Set objOU = GetObject(“LDAP://OU=HR,dc=NA,dc=fabrikam,dc=com”)
Set objUserCopy = objOU.Create(“user”, “cn=BarrAdam”)
objUserCopy.Put “sAMAccountName”, “barradam”
objUserCopy.SetInfo
Set objUserTemplate = _
GetObject(“LDAP://cn=HuffArlene,OU=HR,dc=NA,dc=fabrikam,dc=com”)
arrSVAttributes = Array(“description”, “department”, _
“company”, “wWWHomePage”)
arrMVAttributes = Array(“url”, “otherTelephone”)
For Each strAttrib in arrSVAttributes
strValue = objUserTemplate.Get(strAttrib)
objUserCopy.Put strAttrib, strValue
Next
For Each strAttrib in arrMVAttributes
arrValue = objUserTemplate.GetEx(strAttrib)
objUserCopy.PutEx ADS_PROPERTY_UPDATE, strAttrib, arrValue
Next
objUserCopy.SetInfo
发表回复