To find all the accounts with non-expiring passwords, run the following cmdlet in PowerShell:
Get-ADUser -Filter {Enabled -eq $true -and PasswordNeverExpires -eq $true}
To enable password expiration for the accounts that were found from the above cmdlet, run the following in PowerShell:
Get-ADUser -Filter {Enabled -eq $true -and PasswordNeverExpires -eq $true} | Set-ADUser -PasswordNeverExpires $false
Leave A Comment?