1
嗨我有下面的腳本哪些電子郵件用戶的密碼將在$ daysleftonpwd過期,但不知道如何添加「只有當用戶的密碼設置爲過期」意思我不想給密碼設置爲下一個過期的電子郵件用戶發送電子郵件。Powershell QADUser密碼到期
Get-QADGroupMember -Identity TEAM_GROUP | % {
$name = $_.Name
$email = $_.Email
$daysleftonpwd = ((Get-QADUser -SizeLimit 0 -SearchRoot $OU -Identity $_.SamAccountName | select PasswordExpires).PasswordExpires - $date | select Days).Days
if (((Get-QADUser -Identity $_.SamAccountName | select PasswordExpires).PasswordExpires - $date).Days -lt $threshold){
Write-Host "$Name would be emailed using $email because password is less than $threshold"
$y = $y + "<br>$name</br>"
mailuser
}
任何想法?