Send-MailMessage to AD users meeting specific criteria

I am needing to send a one-time email to a specific list of users based on their last password set date. I’ve used the Get-ADuser cmdlet to pull the list of users I need to send to. Now I just need to know how to incorporate this list into the Send-MailMessage cmdlet. Any help would be much appreciated.

Get-ADuser cmdlet I’m using:

Get-ADUser -Filter * -Properties PasswordLastSet, EmailAddress | Where-Object -FilterScript { $_.PasswordLastSet -lt (Get-Date).AddDays(-80) } | Select-Object -Property EmailAddress

submitted by /u/TNT_Banana
[link] [comments]

Leave a Reply