Skip to content

Instantly share code, notes, and snippets.

@AshFlaw
Created May 2, 2018 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshFlaw/b903ff300fb60f00d494a4de46f1aebc to your computer and use it in GitHub Desktop.
Save AshFlaw/b903ff300fb60f00d494a4de46f1aebc to your computer and use it in GitHub Desktop.
Get computer accounts that haven't logged on in a year.
$duration = (Get-Date).AddDays(-365)
Get-ADComputer -Filter {LastLogonDate -lt $duration} | Select-Object Name, LastLogonDate | Sort-Object Name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment