ADUserOldPW.ps1
<#PSScriptInfo
.SYNOPSIS AD Accounts with passwords over 1-year old .DESCRIPTION Use this script to gather Active Directory Accounts with passwords over 1-year old .VERSION 1.0.1 .AUTHOR gaseceh .PROJECTURI https://github.com/gaseceh .GUID 0d13314a-cd11-49b7-9956-012300fb026a .TAGS Active Directory, ActiveDirectory, AD, old password, aduser .NOTES Run this command as admin You must have Active Directory installed You must be connected to a domain within the network that you are scanning #> #used to get each domain within the forest $domains = (Get-ADForest).domains #set as a 1-year filter $pw_over_365 = (Get-Date).AddDays(-365) #loops thru each domain appending the file with accounts with passwords over 1-year old foreach ($domain in $domains){ get-aduser -Filter 'PasswordLastSet -lt $pw_over_365' -Properties * | Select-Object SamAccountName, PasswordLastSet | out-file -Append $home\desktop\AD_PW_Old.txt } |