Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Import the CSV File with all the stuff.
- Import-CSV C:\Temp\Test.csv
- # Initiate a ForEach Loop.
- ForEach ($User in $Users){
- # Invoke the command to actually change passwords.
- # The following will select each account (Users column), and "Reset" the password to the corresponding string in the "Password" column.
- Set-ADaccountPassword -Identity $User -Reset -NewPassword (ConvertTo-SecureString -AsPlainText $Password -Force)
- #If you want to check the "Force User to Change Password on Next Login" box, un-comment the next line.
- # Get-ADUser $User | Set-ADUser -ChangePasswordAtLogon $true
- }
Advertisement
Add Comment
Please, Sign In to add comment