批量修改用户密码
来源:互联网 发布:mac系统qq远程 编辑:程序博客网 时间:2024/05/29 17:48
一个MVP写的vb代码 const ADS_SCOPE_SUBTREE=2 ------------------------------------- 需要点N次确定,很郁闷。 下面这个: ' Example VBScript to change a user's password ' --------------------------------------------------------' Set objRootDSE = GetObject("LDAP://RootDSE") For each objUser in objOU objUser.Put "userAccountControl", intAccValue WScript.Echo strPassword & " is Password. UserAccountValue = " _ ' End of change password example VBScript 在测试机上通过了,在真实环境没有通过。不知道怎么回事,唉,对VB不熟呀 --- 我吃过这个亏,慎用。
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 200
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "SELECT adspath,name FROM 'LDAP://dc=shenma,dc=local' WHERE objectCategory='user' "
Set objRec = objCommand.Execute
if objRec.BOF OR objRec.EOF then
wscript.echo "不存在"
else
FOR i = 1 to objRec.RecordCount
UserPATH = objRec.Fields("adsPath").Value
set obj = GetObject(UserPATH)
obj.setpassword "111111"
obj.setinfo
wscript.echo objRec.Fields("name").Value
objRec.MoveNext
Next
wscript.echo objRec.RecordCount&"个用户成功!"
end if
' ---------------------------------------------------------'
Option Explicit
Dim objOU, objUser, objRootDSE
Dim strContainer, strDNSDomain, strPassword
Dim intCounter, intAccValue, intPwdValue
' Note: Please change OU=zjsystem, to reflect your domain
' --------------------------------------------------------'
strContainer = "OU=zjsystem, "
strPassword = "888888"
intAccValue = 544
intPwdValue = 0
intCounter = 0
' -------------------------------------------------------'
' Makes the user change H0l1d@y$ password at first logon
' -------------------------------------------------------'
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
strContainer = strContainer & strDNSDomain
set objOU =GetObject("LDAP://" & strContainer )
If objUser.class="user" then
objUser.SetPassword strPassword
objUser.SetInfo
objUser.Put "pwdLastSet", intPwdValue
objUser.SetInfo
objUser.SetInfo
intCounter = intCounter +1
End if
next
& intAccValue & vbCr & intCounter & " accounts changed"
WScript.Quit
--------------
- 批量修改用户密码
- 使用expect批量修改用户密码
- linux passwd批量修改用户密码
- linux系统批量修改用户密码
- linux下批量修改用户密码(转)
- Linux系统批量修改用户密码方法
- Linux 指令详解 chpasswd 批量修改用户密码
- Linux指令详解chpasswd批量修改用户密码
- Linux指令详解chpasswd批量修改用户密码
- Linux指令详解chpasswd批量修改用户密码
- 用户密码修改
- 修改用户密码
- 修改用户密码
- 修改用户密码
- 用户密码修改
- EBS 批量用户密码处理
- 如何修改SqlServer用户密码
- 如何修改mysql用户密码
- 微软将提供用于Exchange Server的免费工具
- exchange 资源贴(转自yinjie)
- 复杂事件处理在金融证券行业的应用
- Periodontitis is the most ancient of human diseases
- DC+Exchange修改IP地址(from 网络猎鹰)
- 批量修改用户密码
- 管理 Outlook 2003 中的脱机通讯簿--1
- vWindows 2003启动组提取方法
- 管理 Outlook 2003 中的脱机通讯簿--2
- 描述 Outlook 2003 使用缓存 Exchange 模式
- 优化大型网络的AD复制---重要(from MS KB)
- 显示器(CRT)显示原理
- C#生成随机数
- 事件 ID 1311 消息进行疑难解答(KCC)---1(MS KB)