Mail notification for bulk accounts expiration

Hello everyone,

I'm looking to set up a monthly email notification system for managers, informing them about users whose accounts are set to expire in the upcoming month.

Currently, I have a process in place for individual email notifications, with one email being sent for each user nearing expiration.

However, I'm seeking guidance on how to streamline this for bulk users, consolidating all relevant information into a single monthly email.


Email Example:
Dear Manager,

In the next moth (February) the following accounts will expire:
User1
User2
User3
...

Any advice on how to efficiently manage this process and send just one comprehensive email per month would be greatly appreciated.

Thank you,

Elena

Parents
  • If you want to do it memory, opposed to outputting to file, you could

    1) Get a list of all users that are going to expired within your timeframe (include the manager attribute), stored in $ExpiringUsers

    2) Get a unique list of manager by $UniqueManagers = $ExpiringUsers | Select-Object Manager -unique

    3) loop through each manager in $UniqueManagers ($UniqueManager in $UniqueManagers)

    a) Get the list of expiring users from the current manager, ie: $CurrentExpiringUsers = $ExpiringUsers | Where-object {$_.Manager -eq $UniqueManager}

    b) Get the current manager details as required for the email

    c) Loop through each $currentExpiringuser, and add the appropriate details to some message body

    c) send email (if manager has email address, otherwise substitute for example the helpdesk email address)

    d) move to the next manager.

Reply
  • If you want to do it memory, opposed to outputting to file, you could

    1) Get a list of all users that are going to expired within your timeframe (include the manager attribute), stored in $ExpiringUsers

    2) Get a unique list of manager by $UniqueManagers = $ExpiringUsers | Select-Object Manager -unique

    3) loop through each manager in $UniqueManagers ($UniqueManager in $UniqueManagers)

    a) Get the list of expiring users from the current manager, ie: $CurrentExpiringUsers = $ExpiringUsers | Where-object {$_.Manager -eq $UniqueManager}

    b) Get the current manager details as required for the email

    c) Loop through each $currentExpiringuser, and add the appropriate details to some message body

    c) send email (if manager has email address, otherwise substitute for example the helpdesk email address)

    d) move to the next manager.

Children
No Data