Requirements: A very common requirement is to change the password for AD users, but the problem is that the amount is too large. So I wrote a script.
CLS
$pass = convertto-securestring-asplaintext 12333333344.abc-force
import-csv-path d:\pp.csv | foreach {
get-aduser-identity $_.name| Set-adaccountpassword-reset-newpassword $pass
get-aduser-identity $_.name| Set-aduser-changepasswordatlogon $false
$_.name
}
This script runs, requires a local module with Active Directory, does not require manual import, and is mounted automatically.
The above script changes the password and also sets whether the next login needs to change the password.
In a foreach loop, you can add multiple actions for user names, such as modifying attributes, account expiration, and so on.
The content format of the Pp.csv file that needs to be used is as follows
Name
Wangerxiao
Dongcunrui
This article comes from "Nine uncle-Microsoft Private Cloud" blog