Posts Tagged ‘Password expiry’

Domain user password expiry with Powershell

I needed to figure out a method for producing alerts when a domain account is approaching the password reset date. Here it is in a few lines of Powershell… ?View Code POWERSHELL# Set name here $name = "Rhys Campbell"; $user = Get-ADUser -LDAPFilter "(Name=$name)" -Properties PasswordLastSet; $days = $(Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge; $expires = $user.PasswordLastSet + $days; $days_left […]