邮件服务器-邮件系统-邮件技术论坛(BBS)

 找回密码
 会员注册
查看: 9786|回复: 12
打印 上一主题 下一主题

急!!如何批量更改AD用户属性!

[复制链接]
跳转到指定楼层
顶楼
发表于 2006-3-6 12:19:02 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
各位大侠,如何可以一次批理更改AD用户的属性,如我想把所有用户的属性里的"用户不能更改密码"勾打上,又或者初始所有用户的密码??
13
发表于 2006-5-18 22:58:28 | 只看该作者

re:这个不错.加精了

这个不错.加精了
12
发表于 2006-5-18 18:18:02 | 只看该作者

re:当用户的"User must chang...

当用户的"User must change password at next logon"开关被Enable了后,需要Disable它。<br>
在这里推荐一个Resource Kits里面的一个工具 cusrmgr,首先看看它的帮助:<br>
<br>
CUsrMgr Ver 1.0 Jan98 by G.Zanzen (c) MCS Central Europe<br>
Sets a random password to a user<br>
usage: -u UserName [-m \\MachineName] \\ default LocalMachine<br>Resetting Password Function<br>-p Set to a random password<br>-P xxx Sets password to xxx<br>User Functions<br>-r xxx Renames user to xxx<br>-d xxx deletes user xxx<br>Group Functions<br>-rlg xxx yyy Renames local group xxx to yyy<br>-rgg xxx yyy Renames global group xxx to yyy<br>-alg xxx Add user (-u UserName) to local group xxx<br>-agg xxx Add user (-u UserName) to global group xxx<br>-dlg xxx deletes user (-u UserName) from local group xxx<br>-dgg xxx deletes user (-u UserName) from global group xxx<br>SetProperties Functions<br>-c xxx sets Comment to xxx<br>-f xxx sets Full Name to xxx<br>-U xxx sets UserProfile to xxx<br>-n xxx sets LogonScript to xxx<br>-h xxx sets HomeDir to xxx<br>
<br>-H x sets HomeDirDrive to x<br>
<br>+s xxxx sets property xxxx<br>-s xxxx resets property xxxx<br>where xxxx can be any of the following properties:<br>MustChangePassword<br>CanNotChangePassword<br>PasswordNeverExpires<br>AccountDisabled<br>AccountLockout<br>RASUser<br>
<br>
<br>
我们激活用户的语法是:<br>
<br>
D:\copypwd>cusrmgr -u adam -s MustChangePassword<br>
<br>
操作完成...<br>
<br>
11
 楼主| 发表于 2006-3-22 17:43:55 | 只看该作者

re:真是高手呀!谢谢!

真是高手呀!谢谢!
10
发表于 2006-3-22 18:37:05 | 只看该作者

re:我发了一个帖子,在精华里有。。我用过...

我发了一个帖子,在精华里有。。<br>
我用过了,没问题的。。我也是有同样的需求才写的脚本。<br>
你可以去精华帖子里看看的。<br>
9
发表于 2006-3-15 17:46:05 | 只看该作者

re:你进不去就给你贴出来Enable U...

你进不去就给你贴出来<br>
Enable Users to Change Their Passwords<br>
<br>
Description<br>
<br>
Disables the User Cannot Change Password option, allowing the user to change their password. <br>
<br>
Supported Platforms<br>
<br>
Windows Server 2003<br>Yes<br><br>
Windows XP<br>Yes<br><br>
Windows 2000<br>Yes<br><br>
Windows NT 4.0<br>Yes<br><br>
Windows 98<br>Yes<br><br>
<br>
Script Code<br>
<br>
Const ADS_ACETYPE_ACCESS_DENIED_OBJECT = &H6<br>
Const CHANGE_PASSWORD_GUID = _<br>"{ab721a53-1e2f-11d0-9819-00aa0040529b}"<br><br>
Set objUser = GetObject _<br>("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")<br>
Set objSD = objUser.Get("nTSecurityDescriptor")<br>
Set objDACL = objSD.DiscretionaryAcl<br>
arrTrustees = Array("nt authority\self", "everyone")<br><br>
For Each strTrustee In arrTrustees<br>For Each ace In objDACL<br>If(LCase(ace.Trustee) = strTrustee) Then<br>If((ace.AceType = ADS_ACETYPE_ACCESS_DENIED_OBJECT) And _<br>(LCase(ace.ObjectType) = CHANGE_PASSWORD_GUID)) Then<br>objDACL.RemoveAce ace<br>End If<br>End If<br>Next<br>
Next<br><br>
objUser.Put "nTSecurityDescriptor", objSD<br>
objUser.SetInfo<br>
<br>
For online peer support, join the microsoft.public.windows.server.scripting community on the msnews.microsoft.com news server. To provide feedback or report bugs in sample scripts or the Scripting Guide, please contact Microsoft TechNet.<br>
<br>
Disclaimer<br>
<br>
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.<br>
<br>
8
 楼主| 发表于 2006-3-15 17:01:55 | 只看该作者

re:我用的就是win2k server+ex...

我用的就是win2k server+exchange2000呀,脚本怎么写?<br>
楼上的地址也进不去
7
发表于 2006-3-8 03:44:50 | 只看该作者

re:FYI: http://www.micr...

FYI: <a target=_blank href=http://www.microsoft.com/technet/scriptcenter/scripts/ad/users/pwds/uspwvb04.mspx>http://www.microsoft.com/technet/scriptcenter/scripts/ad/users/pwds/uspwvb04.mspx</a>
地板
发表于 2006-3-7 13:15:33 | 只看该作者

re:win2k没有此功能

win2k没有此功能
报纸
发表于 2006-3-7 13:14:46 | 只看该作者

re:win2k没有此功能

win2k没有此功能
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

小黑屋|手机版|Archiver|邮件技术资讯网

GMT+8, 2026-8-5 15:16

Powered by Discuz! X3.2

© 2001-2016 Comsenz Inc.

本论坛为非盈利中立机构,所有言论属发表者个人意见,不代表本论坛立场。内容所涉及版权和法律相关事宜请参考各自所有者的条款。
如认定侵犯了您权利,请联系我们。本论坛原创内容请联系后再行转载并务必保留我站信息。此声明修改不另行通知,保留最终解释权。
*本论坛会员专属QQ群:邮件技术资讯网会员QQ群
*本论坛会员备用QQ群:邮件技术资讯网备用群

快速回复 返回顶部 返回列表