工作需要批量更改域内所有用户密码,并且要设置用户登录时不需要更改密码。
Get-ADUser -filter * -SearchBase 'OU=xxx,DC=contoso,DC=com' | Set-ADAccountPassword -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "pass88" -Force)
Get-ADUser -filter * -SearchBase 'OU=xxx,DC=contoso,DC=com' | Set-ADUser -ChangePasswordAtLogon $false