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
Cybersecurity Nightmare: Cisco Data Breach and the Implications for Businesses
A threat actor known as IntelBroker has claimed to have breached Cisco’s systems on October 6th, 2024, stealing a vast amount of sensitive data. The stolen data allegedly includes source…
Read MoreHow PDX IT Services Can Protect Your Business from Data Breaches
Given the recent data breach at Globe Life and the increasing threat of cyberattacks, businesses must prioritize robust cybersecurity measures. PDX IT Services can offer a comprehensive suite of solutions…
Read MoreData Breach at Globe Life: A Growing Threat
Insurance Giant Faces Extortion and Data Exposure In a significant cybersecurity breach, Globe Life, a major life and health insurance provider, has confirmed that it is being extorted by a…
Read More