Posted in

Finding Active Directory passwords set to never expire

Active Directory Logo V2
Active Directory Logo V2

You can print out the accounts with Password Never Expires definition in your structure with the code I have shared below.

Active Directory passwords set to never expir

When you run the code below with powershell, it exports the list of accounts that you want the password to never expire to C:\Temp\PassNeverExpiresUsers.CSV.

Search-ADAccount -PasswordNeverExpires -UsersOnly -ResultPageSize 2000 -resultSetSize $null | Select-Object Name, SamAccountName, DistinguishedName | Export-CSV “C:\Temp\PassNeverExpiresUsers.CSV” -NoTypeInformation

Active Directory passwords

One thought on “Finding Active Directory passwords set to never expire

  1. Bu komut gerçekten işe yarıyor! Ek bir ipucu olarak, aynı çıktıyı elde ederken -Properties Enabled ekleyip sadece etkin hesapları filtreleyebiliriz: `Search-ADAccount -PasswordNeverExpires -UsersOnly -ResultPageSize 2000 -ResultSetSize $null | Where-Object {$_.Enabled} | Select-Object Name, SamAccountName, DistinguishedName | Export-Csv “C:\Temp\PassNeverExpiresUsers.CSV” -NoTypeInformation -Encoding UTF8`. Böylece CSV dosyamızda sadece aktif kullanıcılar yer alıyor ve UTF‑8 kodlaması sayesinde karakter sorunları da önlenmiş oluyor.

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir