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