exchange management shell 中執行
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
$NewUsers = Get-User -ResultSize Unlimited | Where {($_.WhenChanged -gt (get-date).adddays(密码更新周期(天)))}
foreach ($NewUser in $NewUsers)
{
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = "HubTRole.domain.com"
$mailmessage.from = ("Admin@domain.com")
$Recipient = (Get-Recipient $NewUser.identity).PrimarySMTPAddress
$mailmessage.To.add($Recipient)
$mailmessage.Subject = “Message Subject”
$mailmessage.Body = “Type Body Here...”
$smtpclient.Send($mailmessage)
}