MCSE技术论坛

首页 » 开发者俱乐部 » windows脚本 » 复制 Active Directory 用户帐号
smallfox - 2007-12-15 13:38:00
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
sohper - 2007-12-15 13:38:00
强!原创?
smallfox - 2007-12-15 13:46:00
脚本中心的:default6:
wycm - 2008-8-19 9:57:00
在将测试的架构扩展推入生产环境时,建议使用 Ldifde.exe 实用工具
arbiter_2012 - 2008-8-19 13:16:00
呵呵,我在我的中心也贴了这个
1
查看完整版本: 复制 Active Directory 用户帐号