Link to home
Start Free TrialLog in
Avatar of missymadi
missymadi

asked on

How do I include many user names to my Powershell script to reset Passwords?

Experts,

       How do I add more users to my script to update their password?

Thanks, Missymadi
$users = get-qaduser -samaccountname USERNAME 
$users | %{
set-qaduser -Userpassword 'Test'
get-qaduser -samaccountname $_.samaccountname | Select samaccountname, passwordlastset | out-file c:\PwdChanged.txt -noclobber
}

Open in new window

Avatar of KenMcF
KenMcF
Flag of United States of America image

You can do it a few ways

$users = get-qaduser -searchbase "OU=Users_OU,DC=Domain,DC=Local"

$users = get-content c:\users.txt

$users = @(
"User1"
"User2"
"User3"
)
Avatar of missymadi
missymadi

ASKER

How would I add a line that notifies the user that the script completed?
The user running the script or the user that is having the password changed?
The user running the script.
ASKER CERTIFIED SOLUTION
Avatar of KenMcF
KenMcF
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial