AD (Active Directory) Searches

Usage

A Powershell script to find users that have the "Password Never Expire" attribute enabled.

Script

# script to find users that have the "Password Never Expire" attribute enabled

#Import AD module to the session
Import-Module ActiveDirectory

#Search for users and export to CSV

Get-ADUser -Filter * -Properties Name, PasswordNeverExpires | where {
$_.passwordNeverExpires -eq "true" } | Select-Object UserPrincipalName, Name, Enabled | Export-Csv -Path C:\Temp\PwdNeverExpires.csv -NoTypeInformation
cd C:\Temp
start .

Last updated