PowerShell Send-MailMessage - is sending an email to each variable name RRS feed

  • Question

  • I'm new to PowerShell, so this could be an easy question.

    I am creating a script that enables certain users on certain days, I would like this script to send me by email which users were unlocked, I put the users in a variable, and I can activate them, simply using Enable-ADAccount $Login, but when my script will send the email, it sends an email for each login, for example:
    2 Emails
    first email: account unlocked user01
    second email: unlocked account user02

    I wish only one email was sent
    account unlocked, user01, user02
    Sunday, June 30, 2019 5:08 AM


All replies