90 Day Login Date Check
#Purpose: Find the Active Directory account for any user that has not logged in within 90 days
$outputFilePath = 'C:\Users\Public\Documents\90_Day_Check.csv'
$date = (Get-Date).AddDays(-90)
$users = Get-ADUser -Filter {LastLogonDate -lt $date -and Enabled -eq $true} -Properties LastLogonDate |
@{Name='LastLogon';Expression={[DateTime]::FromFileTime($_.LastLogon)}} |
$users | Export-Csv -Path $outputFilePath