Win2008/2012r2下批量更改域用戶密碼

使用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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章