Hi Powershell leaders,
Please help me with below scenario.
I have a situation where i am passing csv file as input to powershell script ;
csv file has username , project name , organisation name , dbname and role name. For each line , i am using invoke-restmethod to post data into website .
For each row , after posting via invoke rest method, I am also sending email notification to user with dbname and rolename in email body .
Now , If my csv file has three records where username , project name , organisation name matches except for dbname , role name; then instead of sending email three times , i would like to send a consolidated mail with all dbnames, rolenames for those 3records in my email body.
How can i check if username,projectname,organisation name in a row matches with subsequent rows, get their dbname, rolename , append it to a hash table which can be used to send them in a consolidated email.
Example : In below example, as projectname,orgname,username matches for usera, instead of sending 2 mails, I need to send a single consolidated email to usera with dbname,rolename detailsof both the matching records