Files
docs/operations/reference/powershell/reporting/inactive-users.md
2026-01-28 20:41:51 -07:00

364 B

tags
tags
PowerShell
Reporting
Scripting
InactiveDays = 30
$Days = (Get-Date).Adddays(-($InactiveDays))
Get-ADUser -Filter {LastLogonTimeStamp -lt $Days -and enabled -eq $true} -Properties LastLogonTimeStamp |
select-object Name,@{Name="Date"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp).ToString('MM-dd-yyyy')}}