您的位置:首页 > 其它

Win2008/2012r2下批量更改域用户密码

2018-09-08 11:52 2551 查看
使用Windows PowerShell批量更改AD用户的密码,使用以下命令,修改对应字段,执行即可。

1、打开Windows PowerShell加载AD模块:

Import-Module ActiveDirectory

2、更改所有域用户的密码:
Get-ADUser -filter * -SearchBase 'DC=xxx,DC=com' | Set-ADAccountPassword -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "abc123AA" -Force)


3、更改指定“test”OU中所有域用户的密码:
Get-ADUser -filter * -SearchBase 'OU=test,DC=xxx,DC=com' | Set-ADAccountPassword -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "123!@#" -Force)

4、设置域用户下次登陆时不需要更改密码:
Get-ADUser -filter * -SearchBase 'DC=xxx,DC=com' | Set-ADUser -ChangePasswordAtLogon $false
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息