title: Can someone pleae help me with new powershell password exp script?
body: <pre><code>$dates = 30, 10, 3, 2, 1 | ForEach-Object {
  (Get-Date).Date.AddDays( - $_)
  }
  Get-ADUser -Filter { Enabled -eq $true} -Properties Description, 'msDS-UserPasswordExpiryTimeComputed' |
  Select-Object SamAccountName, UserPrincipalName, Description,
  @{n='PasswordExpires';e={
      [DateTime]::FromFileTime($_.'msDS-UserPasswordExpiryTimeComputed')
  }}|
      Where-Object { $_.PasswordExpires.Date -in $dates } |
      ForEach-Object { 
      $daysToExpiry = [Math]::Floor(($_.PasswordExpires - (Get-Date)).TotalDays)
  
      $mailParams = @{
          To         = $_.UserPrincipalName
          From       = 'blah@blah.com
          Body       = "Your password will expire in $daysToExpiry"
          Subject    = "Password expires in $daysToExpiry"
          SmtpServer = 'blah.smtp.com'
      }
      Send-MailMessage @params
      $_
  } | Export-Csv output.csv -NoTypeInformation
  </code></pre>
  
  <p>Anyone see anything standing out?  I ran this across my test domain with users setup to expire in 30 days and they do not receive anything.  The csv is also blank.</p>