Get AD account Password ExprityTime

Way1:

net user %username% /domain

Way2:(Powershell)

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties "Name", "msDS-UserPasswordExpiryTimeComputed" | Sort-Object -Property "msDS-UserPasswordExpiryTimeComputed" | Select -Property "Name",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}


!! 待加強
1. Filter by Day
2. Send-MailMessage -from "Helpdesk <helpdesk@noreply.com>" -to "$firstname $surname<$user.mail>" -subject "Password Expiration in $diff days" -smtp "smtpserver" -body $body

留言