A PowerShell script to help manage user and machine accounts.
Get inactive / old computer in your domain as a simple CSV.
# Gets time stamps for all computers in the domain that have NOT logged in since after specified date
import-module activedirectory
$domain = “domain.mydom.com”
$DaysInactive = 90
$time = (Get-Date).Adddays(-($DaysInactive))
# Get all AD computers with lastLogonTimestamp less than our time
Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -Properties LastLogonTimeStamp |
# Output hostname and lastLogonTimestamp into CSV
select-object Name,@{Name=”Stamp”;
Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}} | export-csv OLD_Computer.csv -notypeinformation
Source:
https://gallery.technet.microsoft.com/Get-Inactive-Computer-in-54feafde
Get In Touch
Share On Social Media
Other Recent Blog Articles
Your Cybersecurity Is Only as Strong as Your Weakest Vendor
The Nintendo TinyPulse Breach Is a Wake-Up Call for Every Business Nintendo is one of the most recognized brands on the planet. They guard their intellectual property fiercely, have weathered…
Fake IT Workers Are Showing Up at Offices — And They’re After Your Data
Cybercrime has never been more brazen. Ransomware gangs have long relied on phishing emails and malicious software to compromise businesses — but a group known as the Silent Ransom Group has taken…
The FBI Is Warning Microsoft 365 Users About a Dangerous New Phishing Platform — Here’s What Portland Businesses Need to Know
Published by PDX IT Services | Cybersecurity Alert | 2026 The FBI has issued an urgent warning to Microsoft 365 users about a sophisticated new threat that should have every…