Link to home
Start Free TrialLog in
Avatar of mrdbecker
mrdbecker

asked on

need to parse csv file and email users new password

Good Day,
I have a task to reset training users passwords to a random password and email each person their new password. I have the reset password script working. I just have an issue with the csv file for the email script. The format would be smtpprimaryaddress, newrandompassword in the csv.

How can I get powershell to look at each smtpprimaryaddress and email the corresponding new random password to each user.

I have a one liner that works but I'm not sure how to use variables for the rest.

Send-MailMessage -smtpserver 10.10.10.20 -To user01@domain.com -From admin@domain.com -subject "Your training password has been reset" -body "123456"

Thanks!
David
emailuser-notworking.txt
exampleuserlist.csv
ASKER CERTIFIED SOLUTION
Avatar of Raheman M. Abdul
Raheman M. Abdul
Flag of United Kingdom of Great Britain and Northern Ireland 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
Avatar of mrdbecker
mrdbecker

ASKER

Thanks Raheman! It worked like a charm!